Skip to content

Commit dfa3e44

Browse files
committed
Add max blocking threads option to client
1 parent 2e91a3a commit dfa3e44

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

CLI.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ A Byzantine-fault tolerant sidechain with low-latency finality and high throughp
127127
Default value: `10`
128128
* `--wait-for-outgoing-messages` — Whether to wait until a quorum of validators has confirmed that all sent cross-chain messages have been delivered
129129
* `--long-lived-services` — (EXPERIMENTAL) Whether application services can persist in some cases between queries
130+
<<<<<<< HEAD
131+
||||||| parent of e85007b6307 (Add max blocking threads option to client)
132+
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
133+
=======
134+
* `--tokio-threads <TOKIO_THREADS>` — The number of Tokio worker threads to use
135+
* `--tokio-blocking-threads <TOKIO_BLOCKING_THREADS>` — The number of Tokio blocking threads to use
136+
>>>>>>> e85007b6307 (Add max blocking threads option to client)
130137
* `--blanket-message-policy <BLANKET_MESSAGE_POLICY>` — The policy for handling incoming messages
131138
132139
Default value: `accept`

linera-client/src/client_options.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ pub struct ClientContextOptions {
8888
#[arg(long)]
8989
pub long_lived_services: bool,
9090

91+
/// The number of Tokio worker threads to use.
92+
#[arg(long, env = "LINERA_CLIENT_TOKIO_THREADS")]
93+
pub tokio_threads: Option<usize>,
94+
95+
/// The number of Tokio blocking threads to use.
96+
#[arg(long)]
97+
pub tokio_blocking_threads: Option<usize>,
98+
9199
/// The policy for handling incoming messages.
92100
#[arg(long, default_value = "accept")]
93101
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
@@ -1572,6 +1572,10 @@ fn main() -> anyhow::Result<()> {
15721572
builder
15731573
};
15741574

1575+
if let Some(blocking_threads) = options.tokio_blocking_threads {
1576+
runtime.max_blocking_threads(blocking_threads);
1577+
}
1578+
15751579
let span = tracing::info_span!("linera::main");
15761580
if let Some(wallet_id) = &options.inner.with_wallet {
15771581
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
@@ -64,6 +64,10 @@ pub struct ProxyOptions {
6464
#[arg(long, env = "LINERA_PROXY_TOKIO_THREADS")]
6565
tokio_threads: Option<usize>,
6666

67+
/// The number of Tokio blocking threads to use.
68+
#[arg(long)]
69+
tokio_blocking_threads: Option<usize>,
70+
6771
/// Storage configuration for the blockchain history, chain states and binary blobs.
6872
#[arg(long = "storage")]
6973
storage_config: StorageConfigNamespace,
@@ -386,6 +390,10 @@ fn main() -> Result<()> {
386390
builder
387391
};
388392

393+
if let Some(blocking_threads) = options.tokio_blocking_threads {
394+
runtime.max_blocking_threads(blocking_threads);
395+
}
396+
389397
runtime.enable_all().build()?.block_on(options.run())
390398
}
391399

linera-service/src/server.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ struct ServerOptions {
249249
/// The number of Tokio worker threads to use.
250250
#[arg(long, env = "LINERA_SERVER_TOKIO_THREADS")]
251251
tokio_threads: Option<usize>,
252+
253+
/// The number of Tokio blocking threads to use.
254+
#[arg(long)]
255+
tokio_blocking_threads: Option<usize>,
252256
}
253257

254258
#[derive(Debug, PartialEq, Eq, Deserialize)]
@@ -476,6 +480,10 @@ fn main() {
476480
builder
477481
};
478482

483+
if let Some(blocking_threads) = options.tokio_blocking_threads {
484+
runtime.max_blocking_threads(blocking_threads);
485+
}
486+
479487
runtime
480488
.enable_all()
481489
.build()

0 commit comments

Comments
 (0)