Skip to content

Commit ce1ef04

Browse files
committed
Add max blocking threads option to client
1 parent ce058c8 commit ce1ef04

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

CLI.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
143143
* `--wait-for-outgoing-messages` — Whether to wait until a quorum of validators has confirmed that all sent cross-chain messages have been delivered
144144
* `--long-lived-services` — (EXPERIMENTAL) Whether application services can persist in some cases between queries
145145
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
146+
* `--tokio-blocking-threads <TOKIO_BLOCKING_THREADS>` — The number of Tokio blocking threads to use
146147
* `--blanket-message-policy <BLANKET_MESSAGE_POLICY>` — The policy for handling incoming messages
147148

148149
Default value: `accept`

linera-client/src/client_options.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ pub struct ClientOptions {
153153
#[arg(long, env = "LINERA_CLIENT_TOKIO_THREADS")]
154154
pub tokio_threads: Option<usize>,
155155

156+
/// The number of Tokio blocking threads to use.
157+
#[arg(long)]
158+
pub tokio_blocking_threads: Option<usize>,
159+
156160
/// The policy for handling incoming messages.
157161
#[arg(long, default_value = "accept")]
158162
pub blanket_message_policy: BlanketMessagePolicy,

linera-service/src/linera/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,10 @@ fn main() -> anyhow::Result<()> {
12901290
builder
12911291
};
12921292

1293+
if let Some(blocking_threads) = options.tokio_blocking_threads {
1294+
runtime.max_blocking_threads(blocking_threads);
1295+
}
1296+
12931297
let span = tracing::info_span!("linera::main");
12941298
if let Some(wallet_id) = &options.with_wallet {
12951299
span.record("wallet_id", wallet_id);

linera-service/src/proxy/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ pub struct ProxyOptions {
5858
#[arg(long, env = "LINERA_PROXY_TOKIO_THREADS")]
5959
tokio_threads: Option<usize>,
6060

61+
/// The number of Tokio blocking threads to use.
62+
#[arg(long)]
63+
tokio_blocking_threads: Option<usize>,
64+
6165
/// Storage configuration for the blockchain history, chain states and binary blobs.
6266
#[arg(long = "storage")]
6367
storage_config: StorageConfigNamespace,
@@ -398,6 +402,10 @@ fn main() -> Result<()> {
398402
builder
399403
};
400404

405+
if let Some(blocking_threads) = options.tokio_blocking_threads {
406+
runtime.max_blocking_threads(blocking_threads);
407+
}
408+
401409
runtime.enable_all().build()?.block_on(options.run())
402410
}
403411

linera-service/src/server.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ struct ServerOptions {
283283
/// The number of Tokio worker threads to use.
284284
#[arg(long, env = "LINERA_SERVER_TOKIO_THREADS")]
285285
tokio_threads: Option<usize>,
286+
287+
/// The number of Tokio blocking threads to use.
288+
#[arg(long)]
289+
tokio_blocking_threads: Option<usize>,
286290
}
287291

288292
#[derive(Debug, PartialEq, Eq, Deserialize)]
@@ -537,6 +541,10 @@ fn main() {
537541
builder
538542
};
539543

544+
if let Some(blocking_threads) = options.tokio_blocking_threads {
545+
runtime.max_blocking_threads(blocking_threads);
546+
}
547+
540548
runtime
541549
.enable_all()
542550
.build()

0 commit comments

Comments
 (0)