3 ms·
See... calling reference counting "primitive GC" is I think symptomatic of the wrong thinking here. Reference counting has, for the small heap blocks typical i
by ajross 8y ago
See... calling reference counting "primitive GC" is I think symptomatic of the wrong thinking here. Reference counting has, for the small heap blocks typical in apps that tend to run in this space, non-ignorable (not "high", but real) space and CPU overhead relative to traditional GC. But it's 100% deterministic!
The outrageous amount of work that's gone into two new GC ideas over the last half century has, almost exclusively, been trying to address the latency excursions inherent in trying to collect a giant heap. And it's a completely manufactured problem, because refcounting (and manual allocation strategies more generally) never head it to begin with!
So... I just don't see the point you're trying to make. I mean, yeah, there are a handful of workloads where a good GC will beat naive heap allocation (though the heap solution can always be optimized to beat a GC, by definition). But everything has its sweet spot.
My point is that Java puts its bet on the idea that the GC will work better for effectively all useful workloads. And that's not true. It hasn't been true for 20 years (c.f. all the GC work we're discussing), and it won't be true in the next 20 years either. "We won't get there", as it were.
- pron 8y ago> for the small heap blocks typical in apps that tend to run in this space What space is that? The big applications that the JVM targets have very large working sets (hundreds of GBs or even a couple TBs). > The outrageous amount of work that's gone into two new GC ideas over the last half century has, almost exclusively, been trying to address the latency excursions inherent in trying to collect a giant heap. But that work has been successful! We're now at 1.5ms max pause with an acceptable cost to throughput. > And it's a completely manufactured problem, because refcounting (and manual allocation strategies more generally) never head it to begin with! This is just false. Ref-counted deallocation of a large data structure also introduces latency. Unless you're also controlling the allocator (which is more work), it's also not entirely deterministic. > there are a handful of workloads Those "handful of workloads" are the ones that interest those companies running on the JDK, like Google, Netflix, Apple, Twitter, Amazon and many, many others. I would agree that some use cases benefit more from manual/refcount-collection and some benefit more from tracing, but the market for tracing GCs is humongous. > It hasn't been true for 20 years (c.f. all the GC work we're discussing), and it won't be true in the next 20 years either. "We won't get there", as it were. Well, I strongly disagree, and the millions of happy JDK users will likely disagree, as well.
- mcguire 8y agoYou realize the latency excursion needed to deterministically free a large data structure is also problematic, exacerbated by the background data structure needed to manage allocation and deallocation. (Not all data structures can be "small".) Further, manual heaps tend to scatter your small blocks all over your address space, making your heap work harder as well as doing bad things to your caches. (Unless you go to the work of building cache-aware data structures, which most developers are not capable of considering that they have problems with the discipline needed to make manual management work at all.)
- ajross 8y agoOf course, but it's treatable. Large applications deployed on traditional heap implementations do not, as a general rule, suffer from the kind of GC tuning voodoo that plagues the JVM and which inspired ZGC and Shenandoah (and two decades of their ancestors!). There's no free lunch, but if you know heap behavior is a performance issue in a giant C++ app or whatever, you have a big list of tools with which to address it in software. And in practice this works. Large deployments of, say, PostgreSQL don't require that the admins tune the allocation strategy of the process or carefully size the heap memory internal to the process (obviously there is external tuning at the OS level, though).
- mcguire 8y agoIt's treatable, but not while maintaining deterministic behavior. And I'm a little unclear what the difference in practice is between "GC tuning voodoo" and "a big list of tools". ("external tuning at the OS level" ?= that's not one of your big list of tools)
- spullara 8y agoIf you haven't measured the difference between different allocators for your C++ programs you are probably using the wrong one. The system allocator can be 2-5x slower than an allocator that more closely matches your workload.
- pron 8y agoThere are always tools that help you improve performance, be it with code changes or tuning. The question is how much effort is required to achieve the required performance. I think that the past twenty years have shown that for a huge portion of server applications, GCs are the approach most developers prefer.