On Tue, 24 Mar 2026 13:32:22 GMT, Eirik Bjørsnøs <[email protected]> wrote:

> > I am trying to get more details on the usage and problems arount 
> > Thread.setName(). What I do remember was:
> 
> @rkennke
> 
> I found three instances of `Thread.currentThread().setName` in Apache 
> Cassandra:
> 
> https://github.com/search?q=repo%3Aapache%2Fcassandra+Thread.currentThread%28%29.setName+path%3Asrc%2F&type=code
> 
> The use of this API in `SepWorker` seems supressable by using 
> `-Dcassandra.set_sep_thread_name=false".
> 
> The other, connection-related instances seems not suppressable.

Correct. I also investigated a bit deeper in the Cassanda code-base. It seems 
like SEPWorker is the only place that could potentially get hot.
SEP stands for 'shared executor pool' and is a (default 32 threads) thread pool 
that is shared between 4 kinds of executors (read, mutation, counter_mutation 
and view_mutation). Whenever a worker gets assigned to an executor of a 
different type, it updates its name (e.g. MutationStage-21).

Since the executor name changes on each hop (ReadStage-N → MutationStage-N), 
the "skip unchanged name" optimization won't help here. But the Latin-1 fast 
path/backing-char*-usage and improved shortening will, since these are 
short/medium (max 23 chars) ASCII names.

As you correctly pointed out, setting the thread name can be turned off in 
Cassandra.

Do we think it is worth proceeding with this change?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/30374#issuecomment-4118671447

Reply via email to