Response Timing β
Every /rpc response includes a timing object that breaks down where time was spent. Use it to diagnose latency and understand the full round-trip cost of a request.
TIP
All timings are in milliseconds (ms). 1000 ms = 1 second, so a 200 ms response is 0.2 s.
json
{
"ok": true,
"requestId": null,
"result": "hello",
"error": null,
"timing": {
"decryptMs": 1,
"connectMs": 0,
"execMs": 9,
"proxyMs": 10
}
}Fields β
| Field | Measured at | What it captures |
|---|---|---|
decryptMs | Proxy node | Time to decrypt the encrypted service credentials that the gateway sent. Includes the AES-GCM operation. Normally < 4 ms. |
connectMs | Proxy node | Time to acquire a connection from the per-service connection pool. 0 ms means a pooled connection was reused immediately. A non-zero value means the pool was empty and a new TCP connection had to be opened to your database. |
execMs | Proxy node | Time to run the actual command against your database and receive the result. This is pure database + network time between the proxy node and your database host. |
proxyMs | Proxy node | Total wall-clock time spent inside the proxy node for this request. Equals roughly decryptMs + connectMs + execMs plus a small internal overhead (JSON encoding, etc). |
How to read total latency β
A request travels through two hops:
Client β [gateway] β [proxy node] β [your database]
ββ gateway stages ββ ββ node timing βββproxyMsβ the node's share of the round-trip (decrypt + connect + exec).- Gateway overhead β everything else: API key auth, signature verification, request routing, and JWT signing before the request reaches the node.
- Network β transit between clientβgateway and gatewayβnode is not directly measured but is
totalMs β gatewayOverhead β proxyMs.
Optimising β
connectMs is high | Your connection pool is cold or undersized. Reuse the zedgi client across requests (module-level singleton) so the pool stays warm. |
|---|---|
execMs is high | The query itself is slow. Add an index or optimise the SQL. |
decryptMs > 5 ms | Rare; indicates CPU pressure on the proxy node. |
Total > 500 ms but proxyMs < 50 ms | Latency is in the gateway or network rather than your database. |