Skip to content

Commit 6c389ed

Browse files
committed
Add max blocking threads option to client
1 parent d1d9233 commit 6c389ed

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
@@ -137,6 +137,7 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
137137
* `--wait-for-outgoing-messages` — Whether to wait until a quorum of validators has confirmed that all sent cross-chain messages have been delivered
138138
* `--long-lived-services` — (EXPERIMENTAL) Whether application services can persist in some cases between queries
139139
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
140+
* `--tokio-blocking-threads <TOKIO_BLOCKING_THREADS>` — The number of Tokio blocking threads to use
140141
* `--blanket-message-policy <BLANKET_MESSAGE_POLICY>` — The policy for handling incoming messages
141142

142143
Default value: `accept`

linera-client/src/client_options.rs

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

148+
/// The number of Tokio blocking threads to use.
149+
#[arg(long)]
150+
pub tokio_blocking_threads: Option<usize>,
151+
148152
/// The policy for handling incoming messages.
149153
#[arg(long, default_value = "accept")]
150154
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,
@@ -390,6 +394,10 @@ fn main() -> Result<()> {
390394
builder
391395
};
392396

397+
if let Some(blocking_threads) = options.tokio_blocking_threads {
398+
runtime.max_blocking_threads(blocking_threads);
399+
}
400+
393401
runtime.enable_all().build()?.block_on(options.run())
394402
}
395403

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)]
@@ -521,6 +525,10 @@ fn main() {
521525
builder
522526
};
523527

528+
if let Some(blocking_threads) = options.tokio_blocking_threads {
529+
runtime.max_blocking_threads(blocking_threads);
530+
}
531+
524532
runtime
525533
.enable_all()
526534
.build()

0 commit comments

Comments
 (0)