Content pfp
Content
@
0 reply
0 recast
2 reactions

jtgi pfp
jtgi
@jtgi
surprising 10x speed up in throughput with this change: Before: - await promise 1 - await p2 - await p3 - await p4 After: - await [p1, p2] - await [p3, p4] Running node.js. Expected minor speed up. Underestimated cost of context switching.
10 replies
2 recasts
26 reactions

Kevin pfp
Kevin
@typedarray.eth
Desperate for more details, pls
1 reply
0 recast
0 reaction

jtgi pfp
jtgi
@jtgi
Was that simple; diff below. context: this is a standard http request handler, does about 1rps. The subroutines here are not expensive. I was expecting a minor speed up in proportion to request duration but median request went from ~1500ms to ~70ms. https://gist.github.com/jtgi/a9d9694186360df255481466fd19fac8
2 replies
0 recast
1 reaction

jtgi pfp
jtgi
@jtgi
I'm not too knowledgeable with v8, but I suspect saving the event loop 2 interrupts nets more concurrency. In bursts of traffic, requests used to stack during processing: 1000ms -> 1200ms -> 1400ms... increasing in latency, now they complete ~50ms, p99 @ ~100ms
0 reply
0 recast
0 reaction

Kevin pfp
Kevin
@typedarray.eth
I might be misreading the diff, but looks like you removed the query for `alreadyProcessed`, such that it will now always be undefined? (And perhaps that query was expensive?) Regardless, super curious to get to the bottom of it
1 reply
0 recast
0 reaction