Hacker News new | ask | show | jobs
by jacobn 120 days ago
Most web request cases where you care about performance probably have multiple parallel web requests, so there’s no clean separation possible?
2 comments

Sure, but each request has its own context. Shared resources like DB connection pools will be longer lived but by definition they aren’t alllcated by the request thread. So why not simply exempt everything allocated by a request thread from GC, and simply destroy it on request completion?
Go tried that [1], a failed experiment that was a complex NIH version of the generational hypothesis. They currently use a CMS-stye collector.

[1] https://docs.google.com/document/d/1gCsFxXamW8RRvOe5hECz98Ft...

Generational GC assumes that short lived objects tend to come in groups, which is probably the best you can do in an OO language with shared everything.
His question is still valid for latency. That parallel GC in Java still seems to pause threads from a quick search. https://inside.java/2022/08/01/sip062/
That's why we got ZGC and Shenandoah, and their generational variants, which have very low pause times (in the order of 1 ms)