Skip to content

Commit

Permalink
Standardize thread names
Browse files Browse the repository at this point in the history
Tenets:
1. Limit thread names to 15 characters
2. Prefix all Solana-controlled threads with "sol"
3. Use Camel case. It's more character dense than Snake or Kebab case
  • Loading branch information
mvines committed Aug 20, 2022
1 parent 510d195 commit 2c71344
Show file tree
Hide file tree
Showing 72 changed files with 264 additions and 245 deletions.
2 changes: 1 addition & 1 deletion banks-server/src/banks_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl BanksServer {
}
let server_bank_forks = bank_forks.clone();
Builder::new()
.name("solana-bank-forks-client".to_string())
.name("solBankForksCli".to_string())
.spawn(move || Self::run(server_bank_forks, transaction_receiver))
.unwrap();
Self::new(
Expand Down
2 changes: 1 addition & 1 deletion banks-server/src/rpc_banks_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl RpcBanksService {
let connection_cache = connection_cache.clone();
let exit = exit.clone();
let thread_hdl = Builder::new()
.name("solana-rpc-banks".to_string())
.name("solRpcBanksSvc".to_string())
.spawn(move || {
Self::run(
listen_addr,
Expand Down
2 changes: 1 addition & 1 deletion client/src/rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl RpcClient {
)),
runtime: Some(
tokio::runtime::Builder::new_current_thread()
.thread_name("rpc-client")
.thread_name("solRpcClient")
.enable_io()
.enable_time()
.build()
Expand Down
2 changes: 1 addition & 1 deletion client/src/transaction_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl TransactionExecutor {
let exit = exit.clone();
let cleared = cleared.clone();
Builder::new()
.name("sig_clear".to_string())
.name("solSigClear".to_string())
.spawn(move || {
let client = RpcClient::new_socket_with_commitment(
entrypoint_addr,
Expand Down
2 changes: 1 addition & 1 deletion core/src/accounts_hash_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl AccountsHashVerifier {
let exit = exit.clone();
let cluster_info = cluster_info.clone();
let t_accounts_hash_verifier = Builder::new()
.name("solana-hash-accounts".to_string())
.name("solAcctHashVer".to_string())
.spawn(move || {
let mut hashes = vec![];
loop {
Expand Down
4 changes: 2 additions & 2 deletions core/src/ancestor_hashes_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl AncestorHashesService {
ancestor_socket: Arc<UdpSocket>,
) -> JoinHandle<()> {
Builder::new()
.name("solana-ancestor-hashes-responses-service".to_string())
.name("solAncHashesSvc".to_string())
.spawn(move || {
let mut last_stats_report = Instant::now();
let mut stats = AncestorHashesResponsesStats::default();
Expand Down Expand Up @@ -538,7 +538,7 @@ impl AncestorHashesService {
// to MAX_ANCESTOR_HASHES_SLOT_REQUESTS_PER_SECOND/second
let mut request_throttle = vec![];
Builder::new()
.name("solana-manage-ancestor-requests".to_string())
.name("solManAncReqs".to_string())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
return;
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ impl BankingStage {
let connection_cache = connection_cache.clone();
let bank_forks = bank_forks.clone();
Builder::new()
.name(format!("solana-banking-stage-tx-{}", i))
.name(format!("solBanknStgTx{:02}", i))
.spawn(move || {
Self::process_loop(
&verified_receiver,
Expand Down
8 changes: 4 additions & 4 deletions core/src/broadcast_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl BroadcastStage {
let blockstore = blockstore.clone();
let cluster_info = cluster_info.clone();
Builder::new()
.name("solana-broadcaster".to_string())
.name("solBroadcast".to_string())
.spawn(move || {
let _finalizer = Finalizer::new(exit);
Self::run(
Expand All @@ -277,7 +277,7 @@ impl BroadcastStage {
let cluster_info = cluster_info.clone();
let bank_forks = bank_forks.clone();
let t = Builder::new()
.name("solana-broadcaster-transmit".to_string())
.name("solBroadcastTx".to_string())
.spawn(move || loop {
let res =
bs_transmit.transmit(&socket_receiver, &cluster_info, &sock, &bank_forks);
Expand All @@ -295,7 +295,7 @@ impl BroadcastStage {
let mut bs_record = broadcast_stage_run.clone();
let btree = blockstore.clone();
let t = Builder::new()
.name("solana-broadcaster-record".to_string())
.name("solBroadcastRec".to_string())
.spawn(move || loop {
let res = bs_record.record(&blockstore_receiver, &btree);
let res = Self::handle_error(res, "solana-broadcaster-record");
Expand All @@ -308,7 +308,7 @@ impl BroadcastStage {
}

let retransmit_thread = Builder::new()
.name("solana-broadcaster-retransmit".to_string())
.name("solBroadcastRtx".to_string())
.spawn(move || loop {
if let Some(res) = Self::handle_error(
Self::check_retransmit_signals(
Expand Down
2 changes: 1 addition & 1 deletion core/src/cache_block_meta_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl CacheBlockMetaService {
) -> Self {
let exit = exit.clone();
let thread_hdl = Builder::new()
.name("solana-cache-block-time".to_string())
.name("solCacheBlkTime".to_string())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
break;
Expand Down
6 changes: 3 additions & 3 deletions core/src/cluster_info_vote_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ impl ClusterInfoVoteListener {
let exit = exit.clone();
let bank_forks = bank_forks.clone();
Builder::new()
.name("solana-cluster_info_vote_listener".to_string())
.name("solCiVoteLstnr".to_string())
.spawn(move || {
let _ = Self::recv_loop(
exit,
Expand All @@ -266,7 +266,7 @@ impl ClusterInfoVoteListener {
};
let exit_ = exit.clone();
let bank_send_thread = Builder::new()
.name("solana-cluster_info_bank_send".to_string())
.name("solCiBankSend".to_string())
.spawn(move || {
let _ = Self::bank_send_loop(
exit_,
Expand All @@ -278,7 +278,7 @@ impl ClusterInfoVoteListener {
.unwrap();

let send_thread = Builder::new()
.name("solana-cluster_info_process_votes".to_string())
.name("solCiProcVotes".to_string())
.spawn(move || {
let _ = Self::process_votes_loop(
exit,
Expand Down
2 changes: 1 addition & 1 deletion core/src/cluster_slots_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl ClusterSlotsService {
Self::initialize_lowest_slot(&blockstore, &cluster_info);
Self::initialize_epoch_slots(&bank_forks, &cluster_info);
let t_cluster_slots_service = Builder::new()
.name("solana-cluster-slots-service".to_string())
.name("solClusterSlots".to_string())
.spawn(move || {
Self::run(
blockstore,
Expand Down
2 changes: 1 addition & 1 deletion core/src/commitment_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl AggregateCommitmentService {
sender,
Self {
t_commitment: Builder::new()
.name("solana-aggregate-stake-lockouts".to_string())
.name("solAggCommitSvc".to_string())
.spawn(move || loop {
if exit_.load(Ordering::Relaxed) {
break;
Expand Down
2 changes: 1 addition & 1 deletion core/src/completed_data_sets_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl CompletedDataSetsService {
) -> Self {
let exit = exit.clone();
let thread_hdl = Builder::new()
.name("completed-data-set-service".to_string())
.name("solComplDataSet".to_string())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
break;
Expand Down
2 changes: 1 addition & 1 deletion core/src/cost_update_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl CostUpdateService {
cost_update_receiver: CostUpdateReceiver,
) -> Self {
let thread_hdl = Builder::new()
.name("solana-cost-update-service".to_string())
.name("solCostUpdtSvc".to_string())
.spawn(move || {
Self::service_loop(blockstore, cost_model, cost_update_receiver);
})
Expand Down
2 changes: 1 addition & 1 deletion core/src/drop_bank_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct DropBankService {
impl DropBankService {
pub fn new(bank_receiver: Receiver<Vec<Arc<Bank>>>) -> Self {
let thread_hdl = Builder::new()
.name("sol-drop-b-service".to_string())
.name("solDropBankSrvc".to_string())
.spawn(move || {
for banks in bank_receiver.iter() {
let len = banks.len();
Expand Down
4 changes: 2 additions & 2 deletions core/src/fetch_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl FetchStage {
let poh_recorder = poh_recorder.clone();

let fwd_thread_hdl = Builder::new()
.name("solana-fetch-stage-fwd-rcvr".to_string())
.name("solFetchStgFwRx".to_string())
.spawn(move || loop {
if let Err(e) =
Self::handle_forwarded_packets(&forward_receiver, &sender, &poh_recorder)
Expand All @@ -226,7 +226,7 @@ impl FetchStage {

let exit = exit.clone();
let metrics_thread_hdl = Builder::new()
.name("solana-fetch-stage-metrics".to_string())
.name("solFetchStgMetr".to_string())
.spawn(move || loop {
sleep(Duration::from_secs(1));

Expand Down
2 changes: 1 addition & 1 deletion core/src/find_packet_sender_stake_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl FindPacketSenderStakeStage {
) -> Self {
let mut stats = FindPacketSenderStakeStats::default();
let thread_hdl = Builder::new()
.name("find-packet-sender-stake".to_string())
.name("solPktStake".to_string())
.spawn(move || loop {
match streamer::recv_packet_batches(&packet_receiver) {
Ok((mut batches, num_packets, recv_duration)) => {
Expand Down
6 changes: 3 additions & 3 deletions core/src/ledger_cleanup_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl LedgerCleanupService {
let blockstore_compact = blockstore.clone();

let t_cleanup = Builder::new()
.name("sol-led-cleanup".to_string())
.name("solLedgerClean".to_string())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
break;
Expand All @@ -98,7 +98,7 @@ impl LedgerCleanupService {
.unwrap();

let t_compact = Builder::new()
.name("sol-led-compact".to_string())
.name("solLedgerComp".to_string())
.spawn(move || loop {
if exit_compact.load(Ordering::Relaxed) {
break;
Expand Down Expand Up @@ -238,7 +238,7 @@ impl LedgerCleanupService {
let purge_complete1 = purge_complete.clone();
let last_compact_slot1 = last_compact_slot.clone();
let _t_purge = Builder::new()
.name("solana-ledger-purge".to_string())
.name("solLedgerPurge".to_string())
.spawn(move || {
let mut slot_update_time = Measure::start("slot_update");
*blockstore.lowest_cleanup_slot.write().unwrap() = lowest_cleanup_slot;
Expand Down
2 changes: 1 addition & 1 deletion core/src/ledger_metric_report_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl LedgerMetricReportService {
pub fn new(blockstore: Arc<Blockstore>, exit: &Arc<AtomicBool>) -> Self {
let exit_signal = exit.clone();
let t_cf_metric = Builder::new()
.name("metric_report_rocksdb_cf_metrics".to_string())
.name("solRocksCfMtrcs".to_string())
.spawn(move || loop {
if exit_signal.load(Ordering::Relaxed) {
break;
Expand Down
2 changes: 1 addition & 1 deletion core/src/poh_timing_report_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl PohTimingReportService {
let exit_signal = exit.clone();
let mut poh_timing_reporter = PohTimingReporter::default();
let t_poh_timing = Builder::new()
.name("poh_timing_report".to_string())
.name("solPohTimingRpt".to_string())
.spawn(move || loop {
if exit_signal.load(Ordering::Relaxed) {
break;
Expand Down
2 changes: 1 addition & 1 deletion core/src/qos_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl QosService {
let metrics_clone = Arc::clone(&metrics);
let reporting_thread = Some(
Builder::new()
.name("solana-qos-service-metrics-repoting".to_string())
.name("solQosSvcMetr".to_string())
.spawn(move || {
Self::reporting_loop(running_flag_clone, metrics_clone, report_receiver);
})
Expand Down
2 changes: 1 addition & 1 deletion core/src/repair_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl RepairService {
let exit = exit.clone();
let repair_info = repair_info.clone();
Builder::new()
.name("solana-repair-service".to_string())
.name("solRepairSvc".to_string())
.spawn(move || {
Self::run(
&blockstore,
Expand Down
4 changes: 2 additions & 2 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const MAX_CONCURRENT_FORKS_TO_REPLAY: usize = 4;
lazy_static! {
static ref PAR_THREAD_POOL: ThreadPool = rayon::ThreadPoolBuilder::new()
.num_threads(MAX_CONCURRENT_FORKS_TO_REPLAY)
.thread_name(|ix| format!("replay_{}", ix))
.thread_name(|ix| format!("solReplay{:02}", ix))
.build()
.unwrap();
}
Expand Down Expand Up @@ -436,7 +436,7 @@ impl ReplayStage {

#[allow(clippy::cognitive_complexity)]
let t_replay = Builder::new()
.name("solana-replay-stage".to_string())
.name("solReplayStage".to_string())
.spawn(move || {
let verify_recyclers = VerifyRecyclers::default();
let _exit = Finalizer::new(exit.clone());
Expand Down
4 changes: 2 additions & 2 deletions core/src/retransmit_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,11 @@ pub fn retransmitter(
let num_threads = get_thread_count().min(8).max(sockets.len());
let thread_pool = ThreadPoolBuilder::new()
.num_threads(num_threads)
.thread_name(|i| format!("retransmit-{}", i))
.thread_name(|i| format!("solRetransmit{:02}", i))
.build()
.unwrap();
Builder::new()
.name("solana-retransmitter".to_string())
.name("solRetransmittr".to_string())
.spawn(move || loop {
match retransmit(
&thread_pool,
Expand Down
2 changes: 1 addition & 1 deletion core/src/rewards_recorder_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl RewardsRecorderService {
) -> Self {
let exit = exit.clone();
let thread_hdl = Builder::new()
.name("solana-rewards-writer".to_string())
.name("solRewardsWritr".to_string())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
break;
Expand Down
2 changes: 1 addition & 1 deletion core/src/serve_repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ impl ServeRepair {

let recycler = PacketBatchRecycler::default();
Builder::new()
.name("solana-repair-listen".to_string())
.name("solRepairListen".to_string())
.spawn(move || {
let mut last_print = Instant::now();
let mut stats = ServeRepairStats::default();
Expand Down
2 changes: 1 addition & 1 deletion core/src/serve_repair_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl ServeRepairService {
);
let (response_sender, response_receiver) = unbounded();
let t_responder = streamer::responder(
"serve-repairs",
"Repair",
serve_repair_socket,
response_receiver,
socket_addr_space,
Expand Down
2 changes: 1 addition & 1 deletion core/src/shred_fetch_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl ShredFetchStage {
})
.collect();
let modifier_hdl = Builder::new()
.name("solana-tvu-fetch-stage-packet-modifier".to_string())
.name("solTvuFetchPMod".to_string())
.spawn(move || {
let repair_context = repair_context
.as_ref()
Expand Down
2 changes: 1 addition & 1 deletion core/src/sigverify_shreds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) fn spawn_shred_sigverify(
let recycler_cache = RecyclerCache::warmed();
let mut stats = ShredSigVerifyStats::new(Instant::now());
Builder::new()
.name("shred-verifier".to_string())
.name("solShredVerifr".to_string())
.spawn(move || loop {
match run_shred_sigverify(
&self_pubkey,
Expand Down
2 changes: 1 addition & 1 deletion core/src/sigverify_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl SigVerifyStage {
const MAX_DEDUPER_AGE: Duration = Duration::from_secs(2);
const MAX_DEDUPER_ITEMS: u32 = 1_000_000;
Builder::new()
.name("solana-verifier".to_string())
.name("solSigVerifier".to_string())
.spawn(move || {
let mut deduper = Deduper::new(MAX_DEDUPER_ITEMS, MAX_DEDUPER_AGE);
loop {
Expand Down
2 changes: 1 addition & 1 deletion core/src/snapshot_packager_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl SnapshotPackagerService {
);

let t_snapshot_packager = Builder::new()
.name("snapshot-packager".to_string())
.name("solSnapshotPkgr".to_string())
.spawn(move || {
renice_this_thread(snapshot_config.packager_thread_niceness_adj).unwrap();
let mut snapshot_gossip_manager = if enable_gossip_push {
Expand Down
2 changes: 1 addition & 1 deletion core/src/staked_nodes_updater_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl StakedNodesUpdaterService {
shared_staked_nodes_overrides: Arc<RwLock<HashMap<Pubkey, u64>>>,
) -> Self {
let thread_hdl = Builder::new()
.name("sol-sn-updater".to_string())
.name("solStakedNodeUd".to_string())
.spawn(move || {
let mut last_stakes = Instant::now();
while !exit.load(Ordering::Relaxed) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/stats_reporter_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl StatsReporterService {
) -> Self {
let exit = exit.clone();
let thread_hdl = Builder::new()
.name("solana-stats-reporter".to_owned())
.name("solStatsReport".to_owned())
.spawn(move || loop {
if exit.load(Ordering::Relaxed) {
return;
Expand Down
Loading

0 comments on commit 2c71344

Please sign in to comment.