I'm not sure that's what Go does, but I'm not aware of a faster way on standard hardware.
I'm not sure that's what Go does, but I'm not aware of a faster way on standard hardware.
- https://github.com/golang/go/issues/10958From Mechanical Sympathy Blog [1]
" G1 is target driven on latency –XX:MaxGCPauseMillis=<n>, default value = 200ms. The target will influence the amount of work done on each cycle on a best-efforts only basis. Setting targets in tens of milliseconds is mostly futile, and as of this writing targeting tens of milliseconds has not been a focus of G1. "
So in Java world we are talking 100s of milli seconds of worst case which is 3 order of magnitude higher than Go.
1. http://mechanical-sympathy.blogspot.com/2013/07/java-garbage...
The HotSpot designers have (correctly, IMO) observed that server use cases typically prefer throughput to latency.
On a meta note, I wish people would focus on the actual algorithms instead of taking cited performance numbers out of context and comparing them head to head. The Go GC uses the same concurrent marking and sweeping techniques that CMS does. This change to avoid stop the world stack sweeps is something that no HotSpot collector does. But it's counterbalanced by the fact that Go's GC is not generational. Generational GCs change the balance significantly by dramatically improving throughput.
The question is what use cases can tolerate large throughput hits but not few msec pause times (G1 can also do pauses of a few msec in many cases, I see hundred msec pause times on very large heaps, but not desktop sized heaps).
I suspect there are very few use cases. The G1 team seems to be focusing on scaling to ever larger heaps right now, like hundreds of gigabytes in size. They're relatively uninterested in driving down pause times as Shenandoah is going to provide that for the open source world and Azul already does for the $$$ world.
In general Oracle JDK uses order of magnitude more memory and order magnitudes higher GC latency compare to Go. IMO it is quite useful to remember when deciding on language on new projects. If hotspot people think that these numbers are not true I am sure they would let people know.
* Go's GC is completely non-compacting while G1 is for all generations and CMS for all but the old generation.
* Shenandoah will offer lower pause times by doing concurrent compacting, at the expense of throughput.
* Azul already offers a pauseless compacting collector for hotspot
1. http://www.slideshare.net/RedHatDevelopers/shenandoah-gc-jav...
About the memory footprint: The runtime is larger, so there's a baseline cost you have to pay for the JITs. But baseline != linear cost.
If you have a long-running applications that run more than a few seconds and crunch more than a few MB of data those numbers would change.
So unless you're using the JVM for one-shot script execution those benchmarks are not representative. And if you do then there would be certain optimizations that one could apply.
> There must be some end user (positive) impact of memory compaction in Java.
Fewer CPU cycles overhead per unit of work, i.e. better throughput, which does seem to be an issue for gogc[0]. No risk of quasi-leaks in the allocator due to fragmentation. Reduced cache misses[1]
[0] https://github.com/golang/go/issues/14161 [1] http://stackoverflow.com/q/31225252/1362755
I do not think so. Here is explanation about Java memory bloat in typically used data structures.
https://www.cs.virginia.edu/kim/publicity/pldi09tutorials/me...
Also, `regex-dna` will probably benefit from compact strings in java 9.
And some of the longer-running benchmarks are in fact faster on java, so I think that supports my point about warmup.
Yes, apart from reverse-complement, regex-dna, k-nucleotide, binary-trees.
> Also, `regex-dna` will probably benefit from compact strings in java 9.
Do you actually know that com.basistech will re-write their library to use compact strings?
> I think that supports my point
I think that's called cherry picking.
-- Benchmarks are of limited use.
-- Are JVM startup costs significant?
http://benchmarksgame.alioth.debian.org/sometimes-people-jus...
go version go1.7 linux/amd64
OP "Sub-millisecond GC pauses in Go 1.8"
See http://mattwarren.org/2016/08/08/GC-Pauses-and-Safe-Points/ for all the gory details
It's much more expensive and complex to take an erratic latency operation and bring it down by throwing on more resources. As far as I can tell, the normal design course is making sure all your major actions are either pure or idempotent allowing parallel (and redundant!) requests to be made... which is a large (worthy, but large) engineering effort, and then we're talking about scaling to 2x or more just so you can make that redundant-request thing your default behavior.
For OpemJDK/Hotspot there will be a <100ms GC in Java 9: http://openjdk.java.net/jeps/189
Here is how Zing use flags:
-XX:+UseGenPauselessGC - Generational Pauseless GC (GPGC) optimized for minimal pause times.
Doing the manually triggered & staggered GC trick on a pool of machines you control can give you very low latency guarantees, since no production request will ever hit a GC-ing JVM.
However, 100, even 200ms pauses get "lost" during network coms. But users tend to notice if a page takes 30 seconds to load rather than 1 second (differences i've seen optimising Javas GC, don't know at all how Go and Java compare).
That kind of difference would be very expensive to solve using more servers.
Sever side zero memory leaks absolute requirement and "real time" responses rarely a requirement. triggering gc during init and/or shutdown of a component often enough.
Building a CNC machine - every tick is valuable, but as long as it can run a job for 2 days before crashing no one will notice if it leaks memory like a sieve when you run a calibration routine.
You can also "just" remove servers that are currently in GC from your pool, and have high throughput in a service with reliable latency.
https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gc...
Here are relevant points:
1. If (a) peak application performance is the first priority and (b) there are no pause time requirements or pauses of 1 second or longer are acceptable, then let the VM select the collector, or select the parallel collector with -XX:+UseParallelGC.
2. If response time is more important than overall throughput and garbage collection pauses must be kept shorter than approximately 1 second, then select the concurrent collector with -XX:+UseConcMarkSweepGC or -XX:+UseG1GC.