Over the course of the next several months we hope to implement, test, optimize, and if the numbers warrent, deploy a brand new garbage collection (GC) algorithm for Go. The Transaction Oriented Collector or TOC algorithm will be integrated with and augment Go's current low latency collector. golang.org/s/gctoc contains an overview, some informal proofs showing correctness, and our implementation approach. Comments and suggestions are always welcome.
--
Over the course of the next several months we hope to implement, test, optimize, and if the numbers warrent, deploy a brand new garbage collection (GC) algorithm for Go. The Transaction Oriented Collector or TOC algorithm will be integrated with and augment Go's current low latency collector. golang.org/s/gctoc contains an overview, some informal proofs showing correctness, and our implementation approach. Comments and suggestions are always welcome.
--
--
You received this message because you are subscribed to a topic in the Google Groups "golang-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-dev/WcZaqTE51ZU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-dev+...@googlegroups.com.
This is an interesting document. I have a few questions for you:
1. How does the GC understand that a goroutine is "dormant" between
requests? (As opposed to, say, waiting on i/o to finish processing a
request.)
1a. Do you think this algorithm will implicitly encourage people
towards one-goroutine-per-request architectures?
2. How do you think TOC will degenerate on workloads that do not match
the transactional hypothesis?
2a. What transactional and non-transactional workloads will you use to
evaluate TOC?
I'm enthused. Clever but understandable, seems like a great fit for Go and a lot of stuff folks build in it.Am I guessing right that the single contiguous span is a simplification to describe the idea, and there are still spans per size class, etc.? If so, does that mean that a goroutine's min. footprint while running might include a span for each size class it uses where they don't now? Seems fine if so (we're still talking KBs and you get a lot in return), but could rate a sentence in any eventual release notes, .
Something fun re: data being published in possibly surprising ways. The net/http server uses a sync.Pool to get a pointer to a bufio.Writer likely allocated by some other goroutine, and then sets the bufio.Writer's target io.Writer to a chunkWriter for writing to the HTTP response. The chunkWriter holds a pointer to the response, so it can reach request and response headers, etc. So by using a *bufio.Writer that isn't in your local spans, you prevent the TOC from collecting the whole request/response objs. Not how big a deal that is in terms of bytes, but it's surprising behavior! (Also, talking here about HTTP/1.1 code to be clear. Know h2 stuff is intentionally communicating a lot.)
Here I see two workarounds. If you copy a bufio.Writer by value instead of by pointer, now it really is in local memory and setting its Writer doesn't publish anything. (If you're doing that you'd also need to reset the target io.Writer to nil before returning it to the pool.) I imagine something similar may come up in other situations--you wish some struct were local but it's not, so you copy it and your wish comes true, heh. Or, much simpler fix, but more specific to this situation, is to drop the sync.Pools if TOC makes it cheap to just locally alloc a bufio.Writer per response.Assuming this goes in, I am sort of curious what you guys' position winds up being re: launching goroutines you otherwise wouldn't as a hint to the collector, and curious if a runtime.LocalGC() will be exposed. I'm not sure I have much to add on either.
Good questions but I will try to avoid speculation. Ask us again in several months when we have better answers.
--
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
Thinking of this more, if we have not just secondary shadow stack, but a secondary shadow stack per _frame_, then we could even express things like: if this conditional dynamically-sized allocation site allocate, then the allocation needs to go to parent-parent secondary stack, because compiler proved that it is scoped against parent-parent frame.Such scheme is potentially capable of capturing most of what TOC would capture, and maybe even more (e.g. allocations that are temporary accessible to another goroutine but still scoped against host goroutine), while still providing cheap allocation, perfect locality and prompt, bulk deallocation with no barriers involved.
--