Experience of adding JDK21 virtual thread support to a DB application

Matthew Swift matthew.swift at gmail.com
Mon Jun 24 15:58:50 UTC 2024


It looks like AbstractQueuedSynchronizer#acquire(...) does appear to do
some spinning IIUC, but it's probably quite different to the spinning
strategy used by contended monitors. I'm just guessing though.

On Fri, 21 Jun 2024 at 20:45, Alan Bateman <Alan.Bateman at oracle.com> wrote:

>
>
> On 21/06/2024 16:57, Matthew Swift wrote:
> > :
> >
> > These results are on my laptop (Intel i9-13900H with 10 cores, Linux
> > 6.5, JDK 21.0.3), but we see similar regressions on larger older
> > machines in our labs. Also worthy of note is that the context
> > switching rate increases from around 180K/s when using synchronized()
> > to 300K/s when using ReentrantLock. I know that ReentrantLock is
> > supposed to be a little bit less efficient in highly contended
> > situations, but I was surprised by an 8-10% impact. Is that expected?
>
> One thing that might be part of this is that a contented monitor enter
> does a small amount of spinning. Sergey Kuksenko may have some comments
> on this as he has some proposals on this at one point.
>
> -Alan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20240624/7123f1b7/attachment.htm>


More information about the loom-dev mailing list