Nitsan Wakart
psy-lob-saw.blogspot.com · Personal blog · on HN since 2013
Nitsan Wakart writes about low-latency Java, JVM performance, profiling, and concurrent queues, with a focus on mechanical sympathy.
What HN saysCommenters recommend it as a great resource on concurrency and the memory system, noting it hasn't been updated since 2018 but remains valuable.
31HN people shared it
12linked it in comments
50stories submitted
644story points
4 months agolast shared
2013people per year2026
Most-shared posts
- 1The Escape of ArrayList.iterator()4 people · 21 points · first shared 2015 · 2 comments on HN
- 2What a difference a JVM makes?4 people · 10 points · first shared 2018 · discussion on HN
- 3Most Sampling Java Profilers Are Terrible3 people · 59 points · first shared 2016 · 23 comments on HN
- 4Homepage3 people · first shared 2014
- 5Notes On Concurrent Ring Buffer Queue Mechanics2 people · 45 points · first shared 2014 · 4 comments on HN
- 6How Inlined Code Makes for Confusing Profiles2 people · 28 points · first shared 2018 · 3 comments on HN
- 7The Mythical Modulo Mask (2014)2 people · 18 points · first shared 2014 · discussion on HN
- 8JMH Perfasm Explained: Looking at False Sharing on Conditional Inlining2 people · 13 points · first shared 2015 · discussion on HN
- 9On Arrays.fill, Intrinsics, SuperWord and SIMD Instructions2 people · 11 points · first shared 2015 · 1 comments on HN
- 10Expanding the Queue Interface: Relaxed Queue Access2 people · 9 points · first shared 2015 · discussion on HN
- 11GC 'Nepotism' and Linked Queues2 people · 4 points · first shared 2016 · discussion on HN
- 12How to Examine and Verify your Java Object Memory Layout2 people · 1 points · first shared 2013 · discussion on HN
- 13Safepoints: Meaning, Side Effects and Overheads (2015)2 people · 1 points · first shared 2016 · discussion on HN
- 14Homepage2 people · first shared 2015
- 15135M messages a second between processes in Java (2013)1 people · 262 points · first shared 2016 · 157 comments on HN
What HN people wrote when they linked it
gwittel · 2022-06-22
Vanilla Java is a great resource. The work that Chronicle does got me into low latency Java as well (not doing java now though).
Some other great resources I used:
* http://psy-lob-saw.blogspot.com/ - Not updated since 2018, but still great stuff in there
* https://richardstartin.github.io/ - A few posts per year. Richard does a lot of interesting things.
matthewwarren · 2017-02-08
> Matt Warren's blog is great to learn about the internal mechanism of .Net
Yeah I do seem to write alot about .NET internals, but I just seem to keep finding cool stuff in there!!
> I wonder if there is any similar blog for JVM world,
Another Java-based blog I like reading is http://psy-lob-saw.blogspot.co.uk/, I've definitely taken some inspiration from there and written .NET equivalents of his posts.
pron · 2014-03-30
For all those interested in this subject, I'd like to recommend Nitsan Wakart's blog, http://psy-lob-saw.blogspot.com/, which is dedicated to mechanical sympathy relating to concurrency and the memory system.
panic · 2017-07-25
Here are a bunch of blogs from my RSS reader that I think are worth reading. Some of them haven't updated in a while, but the archives may be worth a look anyway.
* Blogs with a math focus:
http://blog.sigfpe.com
http://bit-player.org
http://mathr.co.uk/blog/
https://www.johndcook.com/blog/
* Blogs with a programming languages focus:
https://existentialtype.wordpress.com
https://bluishcoder.co.nz
http://blog.ezyang.com
http://akkartik.name
http://lambda-the-ultimate.org
http://mrale.ph
* Blogs with a UI design focus:
http://www.brandonwalkin.com/blog/
http://ignorethecode.net/blog/
http://interuserface.net
* Blogs with a graphics / 3D rendering focus:
http://c0de517e.blogspot.com
http://diaryofagraphicsprogrammer.blogspot.com
https://directtovideo.wordpress.com
http://graphicrants.blogspot.com
http://www.reedbeta.com
http://www.realtimerendering.com/blog/
https://blog.demofox.org
http://eelpi.gotdns.org/blog.wiki.html
* Other interesting / more general programming blogs (many of these have a "systems" focus):
http://danluu.com
http://ewontfix.com
http://chneukirchen.org/blog/
http://neverworkintheory.org
http://apenwarr.ca/log/
https://www.snellman.net/blog/
https://www.pvk.ca
http://psy-lob-saw.blogspot.com
https://randomascii.wordpress.com
http://fastcompression.blogspot.com
https://fgiesen.wordpress.com
http://blog.plover.com
http://chneukirchen.org/trivium/
http://rachelbythebay.com/w/
fmstephe · 2015-11-02
If you like Go I have written a ringbuffer library here
https://github.com/fmstephe/flib
have a look in queues/spscq. spsc here stands for single producer, single consumer.
I gave a talk in London about these queues here
https://skillsmatter.com/skillscasts/6163-high-performance-single-prod…
-------------------
But all of this work is based on the work, and teaching, of Martin Thomson.
Martin Thomson has published a large collection of data structures (which probably include these ringbuffers (I haven't checked specifically))
https://github.com/real-logic/Agrona
If you are near Ireland I highly recommend Martin Thomson's concurrency course
http://instil.co/courses/writing-concurrent-code-with-lock-free-algori…
----------
I highly recommend Nitsan Wakart's blog. He covers a lot of interesting ground, all in Java. Probably best to start at the early blog posts and work your way forward.
http://psy-lob-saw.blogspot.co.uk/
Nitsan contributes to a very focused java library here
https://github.com/JCTools/JCTools
cogman10 · 2026-07-13
Ah shoot, you're right this wouldn't be what I'm thinking.
I was thinking of "GC Nepotism" [1]. That's the case where an object in old gen pointing to an object in new gen will automatically promote that new gen object into old gen. This can be particularly problematic with graph structures.
[1] https://psy-lob-saw.blogspot.com/2016/03/gc-nepotism-and-linked-queues…
wsargent · 2020-07-25
Can confirm -- writing data to memory is incredibly fast. It's faster to use a lock-free queue and use CAS to insert data though:
http://psy-lob-saw.blogspot.com/2016/12/linked-array-queues-part-2-sps…
I've benchmarked code myself, and the flamegraphs will barely show the SpscArrayQueue in the profile.
kjeetgill · 2018-07-18
This is already a standard piece of how JITs work today. See the discussion of Java intrinsics and Array.fill() here [0].
> An intrinsic function is applied as a method substitution [...] and the compiler will replace it's apparent source-level implementation with a pre-cooked implementation. In some cases intrinsics are sort of compilation cheats [...]
> The intrinsics are all set up in vmSymbols.hpp and if you look, you'll see Arrays.fill is NOT on the list. [...] Because it is something like an intrinsic... [...] What is it then? Arrays.fill is a code pattern substitution kind of compiler shortcut, basically looking for this kind of loop:
```
for (int i = 0; i < arrayB.length; i++) {
arrayB[i] = b;
}
```
And replacing it with a call into the JVM memset implementation.
[0]: http://psy-lob-saw.blogspot.com/2015/04/on-arraysfill-intrinsics-super…
reader_1000 · 2018-01-01
Escape analysis should handle this [1], but I don't know if it does all the time. Reliably profiling this is hard, I guess.
http://psy-lob-saw.blogspot.com.tr/2014/12/the-escape-of-arraylistiter…
vardump · 2016-06-13
I just read this: http://psy-lob-saw.blogspot.com/2015/12/safepoints.html
Wow, I had no idea how bad sampling profilers are on JVM. And apparently JVM profiling in general. So collecting a stack trace sample requires a thread being suspended at a safepoint. And a global safepoint requires suspending all threads? Sampler that needs to do that will surely not only miss real CPU time consumer but also significantly alter performance behavior.
Instrumentation is indeed often a pretty bad option as well.
Is it possible to resolve JVM stack traces captured from kernel side (Windows and Linux have mechanisms for this)? That would certainly get around any safepoint restrictions, right?
hyperpape · 2016-01-09
I know that profiling using VisualVM (or most other profilers) can substantially change the garbage collection behavior of an application (http://psy-lob-saw.blogspot.com/2014/12/the-escape-of-arraylistiterato…
I don't know if using VisualVM in the way this article does has the same effect--sounds like the author is not doing any actual profiling, so it may not be an issue. Additionally, since this is a synthetic benchmark, you might argue that it's not important. Still, I'd tend to think it makes more sense to use OS level tools to monitor the CPU usage and avoid changing the behavior of the JVM.
twoodfin · 2015-01-15
Just as an aside, sometimes slicing up your arrays-of-structs into structs-of-arrays brings big locality improvements.
Anyway, you can usefully control some aspects of how Java lays out your data, including primitive fields:
http://psy-lob-saw.blogspot.com/2013/05/know-thy-java-object-memory-la…