cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Shopov (JIRA)" <>
Subject [jira] [Commented] (CASSANDRA-10031) Name threads for improved ops/debugging
Date Mon, 09 Nov 2015 11:57:11 GMT


Alexander Shopov commented on CASSANDRA-10031:

Here I have gathered all instances of naming threads in current Cassandra tree.
Whatever new names we introduce - it is good to have some convention. I want
to discover what convention there is in practice.

There are two basic ways of naming a thread judging from the public Java API.
1. After creation there is the j.l.Thread.setName(String name) method
2. At creation - there are the different constuctors that either explicitly take
a String name parameter or default to some convention - which in Oracle's JDK is
expressed by the private init methods called by the constructor.

Here comes a list with all occurences I could find. First I state the method
that actually names the thread and then its usage in Cassandra - qualified name
of Class or Method using it, number of the line this happens in the source file
containing the aforementioned Class or Method. In cases that use implicit naming
I state the rule at the start. In cases that use explicit naming - I state the
name per case on next line.

1. j.l.Thread.setName(String name):
  This explicitly sets the thread name. Found 1 usage: #141 - name is "RepairTracePolling"

2. j.l.Thread.Thread():  
  This uses default naming of "Thread-" + CONSECUTIVE_POSITIVE_INTEGER - 11 usages #192
  org.apache.cassandra.thrift.ThriftServer.ThriftServerThread #108
  org.apache.cassandra.db.commitlog.CommitLogStressTest.CommitlogExecutor #400
  org.apache.cassandra.locator.DynamicEndpointSnitchLongTest.ScoreUpdater #78
  org.apache.cassandra.db.commitlog.CommitLogUpgradeTestMaker.CommitlogExecutor #210 #212
  org.apache.cassandra.service.RemoveTest.testRemoveHostId() #116
  org.apache.cassandra.utils.CoalescingStrategiesTest.parkLoop() #237
  org.apache.cassandra.stress.Stress.ShutDown #142
  org.apache.cassandra.stress.StressAction.Consumer #250
  org.apache.cassandra.stress.StressServer.StressThread #76

3. j.l.Thread.Thread(Runnable)
  This also uses default naming of "Thread-" + CONSECUTIVE_POSITIVE_INTEGER - 10 usages
CompressionInfo, ChecksumType, Supplier<Double>) #79, UUID) #351
  org.apache.cassandra.service.StorageService.forceRepairAsync(String, RepairOption) #3069
  org.apache.cassandra.metrics.LatencyMetricsTest.testGetRecentLatency() #44
  org.apache.cassandra.concurrent.WaitQueueTest.testSerial(WaitQueue) #47
  org.apache.cassandra.concurrent.WaitQueueTest.testCondition(WaitQueue) #87
  org.apache.cassandra.hints.HintsBufferTest.testWrite() #117
  org.apache.cassandra.cache.CacheProviderTest.concurrentCase(CachedBTreePartition, ICache<MeasureableString,
IRowCacheEntry>) #138
  org.apache.cassandra.cql3.ViewLongTest.testConflictResolution() #95 #93
4. j.l.Thread.Thread(String)
  This explicitly sets the name
    "client-" + List<InetAddress> endpoints, Socket,
Set<Closeable>) #47 
     "STREAM-INIT-" + socket.getRemoteSocketAddress(), boolean, Socket,
Set<Closeable>) #59
     "MessagingService-Incoming-" + socket.getInetAddress(), String)
     "ACCEPT-" + localEp // -  InetAddress whose port to listen on
     "MessagingService-Outgoing-" + pool.endPoint() //  j.n.InetAddress #487
     "HANDSHAKE-" + poolReference.endPoint() //  j.n.InetAddress
Logger, String) #127 
     displayName + " debug thread" // displayName  one of "Time horizon moving average", "Moving
average", "Fixed", "Disabled"
  org.apache.cassandra.utils.memory.MemtableCleanerThread.MemtableCleanerThread(P, Runnable)
     pool.getClass().getSimpleName() + "Cleaner"

j.l.Thread.Thread(Runnable, String)
  This explicitly sets the name
  org.apache.cassandra.concurrent.SEPWorker.SEPWorker(Long, Work, SharedExecutorPool)  #48
     pool.poolName + "-Worker-" + workerId  // poolName is SharedExecutorPool workerId is
  org.apache.cassandra.db.commitlog.AbstractCommitLogService.start() #161 
  org.apache.cassandra.db.commitlog.CommitLogSegmentManager.start() #170 
  org.apache.cassandra.service.StorageService.initServer(int) #689
  org.apache.cassandra.streaming.ConnectionHandler.MessageHandler.start(Socket, int) #202
     name() + "-" + session.peer // name() is one of "STREAM-IN", "STREAM-OUT" and peer is
  org.apache.cassandra.utils.TopKSamplerTest.testMultithreadedAccess() #82 

j.l.Thread.Thread(ThreadGroup, Runnable, String)
 This explicitly sets the name, many possible values
  org.apache.cassandra.concurrent.NamedThreadFactory.newThread(Runnable) #58  
  *  id + ":" + n.getAndIncrement() // id is String, n new AtomicInteger(1)
  *  "Repair#" + cmd //  cmd is int
  *   // one of the following
    "Reference-Reaper", "Strong-Reference-Leak-Detector", "internal",
    "CommitLogArchiver", "CommitLogArchiver", "RepairJobTask",  
    "HintsWriteExecutor", "SSTableBatchOpen", "StreamConnectionEstablisher",
    "ReadStage", "MutationStage", "CounterMutationStage", "ViewMutationStage",
    "GossipStage", "RequestResponseStage", "AntiEntropyStage", "MigrationStage",
    "MiscStage", "TracingStage", "InternalResponseStage", "ReadRepairStage",
    "StreamingTransferTaskTimeouts", "StreamReceiveTask", "LocalPool-Cleaner",
    "PendingRangeCalculator", "MemtableFlushWriter", "MemtableFlushWriter",
    "MemtableReclaimMemory", "Thrift", "RPC-Thread", "SecondaryIndexManagement",
    "Sampler", "JmxCollector", "StressMetrics", "TEST", "MODIFY", "COMPARE",

> Name threads for improved ops/debugging
> ---------------------------------------
>                 Key: CASSANDRA-10031
>                 URL:
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: T Jake Luciani
>            Priority: Minor
>              Labels: lhf
>             Fix For: 3.x
> We currently provide basic names for threads in threads like {{STREAM-IN-1}}  which gives
some basic information about what the job of the thread is.  
> When looking at a log statement or jstack it's helpful to have this context.
> For our work stealing thread pool we share threads across all thread pools so we lose
this insight.  
> I'd like to propose we start using the Thread.currentThread().setName("")
> In different aspects of the code to improve insight as to what cassandra is doing at
any given moment.
>    * At a minimum in the start of each run() method.
>   Ideally for much finer grain things.
>    * In compaction include the partition name currently being working on.  
>    * In SP include the client ip
> Etc...

This message was sent by Atlassian JIRA

View raw message