Consider Adding Thread Affinity
Enrico Olivelli
eolivelli at gmail.com
Tue Dec 1 06:10:26 UTC 2020
Suminda,
In Apache Bookkeeper project we have this module, available on Maven Central
It allows to control thread affinity.
https://github.com/apache/bookkeeper/tree/master/cpu-affinity
I hope that helps
Enrico
Il Mar 1 Dic 2020, 00:15 David Holmes <david.holmes at oracle.com> ha scritto:
> On 1/12/2020 2:53 am, Suminda Sirinath Salpitikorala Dharmasena wrote:
> > This mainly aims to prevent cache misses as:
> > - previously cached values of the thread may be in the cache
> > - threads which share data can be targeted at a given core for better
> data
> > locality
> > - ensure threads are planned based on locks are common/shared
> > resource usage which is known to the programmer than OS
> >
> > I believe this is an important feature to consider for performance.
>
> Are you talking about virtual threads or regular (carrier) threads?
>
> General thread affinity has been raised in the past but it is a highly
> sensitive operation in relation to performance and extremely easy to
> misuse (hurting not only the performance of your own application but
> potentially the whole machine). Further to support thread affinity you
> also need a way to expose detailed CPU topology information (sockets,
> processors, cores) that does not presently exist in Java and which was
> considered too machine/hardware specific to be considered a good
> candidate for a portable Java API. With virtualized environments of
> various forms, thread affinity is even harder to use.
>
> Also note that the system/OS scheduler will itself try to address
> low-level cache affinity when making scheduling decisions.
>
> Cheers,
> David
> -----
>
> > Suminda
> >
> >
> > On Mon, 30 Nov 2020 at 21:22, Ron Pressler <ron.pressler at oracle.com>
> wrote:
> >
> >> Hi.
> >>
> >> We have no concrete plans for doing so, but can you, perhaps, explain
> the
> >> use-case and why it’s important?
> >>
> >> — Ron
> >>
> >>
> >> On 27 November 2020 at 14:17:07, Suminda Sirinath Salpitikorala
> Dharmasena
> >> (sirinath1978m at gmail.com) wrote:
> >>
> >> Hello,
> >>
> >> Is it possible to consider adding thread affinity to the Thread API?
> >>
> >> Suminda
> >>
> >>
>
More information about the loom-dev
mailing list