Wrapping virtual threads in predefined ExecutorService.

Andrii Lomakin lomakin.andrey at gmail.com
Sat Jun 17 12:27:30 UTC 2023


Ron and team.
Thank you very much for your prompt responses and advices. I do value your
help.
We are evaluating the design now. I just wanted to be sure that in case we
will confirm the benefits of thread-per-core architecture we can rely on
virtual threads tooling.


On Sat, Jun 17, 2023 at 2:13 PM Ron Pressler <ron.pressler at oracle.com>
wrote:

> Yes, we do have such plans, but I would strongly recommend against picking
> such designs before actually proving to yourself that they yield a
> significant benefit.
>
> Thread-per-core is not generally faster than multi-core scheduling; in
> some particular situations it may be significantly faster, in other
> situations it may be significantly slower, while in some situations it can
> be pretty much the same. In particular, it works well when you have an
> efficient and well-balanced sharding scheme that ensures that the level of
> contention between two transactions is known in advance, and it is that
> knowledge that provides the most benefit. The primary optimisation is
> running transactions that are known to contend sequentially rather than in
> parallel; the lack of memory synchronisation operations is a secondary
> optimisation (because uncontended CASes are relatively cheap).
>
> So I would suggest that you first focus on designing your database for a
> sharding scheme that fits thread-per-core well and on arranging your
> transactions accordingly, and only then reaching for lower-level
> optimisations. If you can’t get a significant benefit from the first part
> alone, you won’t get any from the second.
>
> — Ron
>
>
> > On 16 Jun 2023, at 06:58, Andrii Lomakin <lomakin.andrey at gmail.com>
> wrote:
> >
> > Good day devs!
> >  I am considering the creation of a database server that is working on
> thread-per-core architecture. So I have a question: do you have plans to
> implement the possibility of using virtual threads executor on the base of
> a passed executor?
> >
> > P.S. I am aware of problems with synchronization inside JDK classes,
> libraries, and pinned threads.
> >
> > --
> > Best regards,
> > Andrii Lomakin.
> >
>
>

-- 
Best regards,
Andrii Lomakin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230617/924a5493/attachment.htm>


More information about the loom-dev mailing list