Repository navigation
perf(mesh): win back the mesh RPC throughput #97 cost - #116
Merged
Merged
Conversation
GT_MESH=1 boots a teapot in the server process that exports one step and a teacup route that needs it. No A/B case covered the mesh RPC path before. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
The week-1 regression A/B on jarvis measured mesh rpc at -4.3% on Node, -6.3% on Deno and -2.7% on Bun (ranges separated; Node A/A -1.2%). Bisecting the merges put all of it on #97, and swapping files back put it on src/mesh/link.ts: a closure and a performance.now() per call to build an event payload. The pending entry now holds plain fields (started, correlation) and a plain function builds the payload. A call is timed only when something listens to mesh:rpc or mesh:rpc:error, so apps without a metrics listener pay nothing. Also: one {bus, url} per link instead of per call, and the teapot decrements its in-flight counter in handleRpc's finally instead of chaining .finally(). Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This was referenced Nov 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Regression benchmark for the week-1 mesh work (#95–#98, merged in #112–#115), and the fix for what it found. Full method and tables:
bench/results/mesh-week1-46e0bc9-20f5094/README.md.What the A/B found (jarvis, Docker node:22, cpuset 6,7,14,15)
mesh rpc (1 remote step)case, since no case covered it): Node −4.3%, Deno −6.3%, Bun −2.7%, ranges separated (Node A/A −1.2%).src/mesh/link.ts: a closure plusperformance.now()per call to build an event payload.Fix
started,correlation), and a plain function builds themesh:rpc/mesh:rpc:errorpayload.mesh:rpcormesh:rpc:error, so an app without a metrics listener pays nothing.{bus, url}per link, not per call. The teapot decrements its in-flight counter inhandleRpc'sfinallyinstead of chaining.finally().test/mesh/events.test.ts).After the fix (base
46e0bc9vs this branch, mesh only)Not measured: mesh RPC with a
mesh:rpclistener attached (the metrics-plugin case pays one timing pair and one payload per call, by design), route proxying over the mesh, and WebSocket.Also in this PR
bench/compare.tsandbench/servers/compare.tsgain the mesh case (GT_MESH=1).Verified locally
lint, format, complexity, typecheck, typecheck:bench, coverage, build, api:check, test:deno (71), test:bun (61), test:edge.