3 ms·
> I was writing some highly concurrent code and initially wrote it with the jdk's lock-free containers, but found that GC was about 5-10x worse (depending on th
by bsder 11y ago
> I was writing some highly concurrent code and initially wrote it with the jdk's lock-free containers, but found that GC was about 5-10x worse (depending on the workload) than simply wrapping the non-concurrent equivalent in a lock.
That seems a bit high, but I can believe it under heavy contention.
But, you measured, and then optimized. Which is what people should be doing but aren't.
- gamegoblin 11y agoThe biggest of them was all of the Node objects that ConcurrentSkipListSet generates. Replacing that with a synchronized TreeSet fixed most GC issues. Yes, this was a 100K+ element collection being concurrently used by 1000+ threads. I used YourKit to profile.