#[non_exhaustive]pub struct LaunchConfig {Show 15 fields
pub drain_budget: Duration,
pub request_timeout: Duration,
pub max_in_flight: usize,
pub max_body_bytes: usize,
pub cache_max_entries: usize,
pub cache_sweep_interval: Duration,
pub ws_drain_deadline: Duration,
pub cors: Option<CorsConfig>,
pub shutdown_trigger: Option<Arc<Notify>>,
pub expose_docs: bool,
pub ws_outbound_buffer: usize,
pub ws_max_connections: usize,
pub ws_ping_interval: Duration,
pub adaptive_shed_target: Duration,
pub ws_idle_timeout: Duration,
}Expand description
Tunables for the launch contract. Start from Default and adjust:
App::launch_configured::<AppModule>(addr, info, plugins, LaunchConfig {
request_timeout: Duration::from_secs(10),
max_in_flight: 4_096,
cors: Some(CorsConfig::for_origins(["https://app.example.com"])),
..Default::default()
}).awaitFields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.drain_budget: DurationPer-plugin budget for on_shutdown / start-failure rollback (and the
concurrent on_draining notification). A plugin exceeding it is
skipped with a logged warning — it can never wedge the process.
Default 5s.
request_timeout: DurationProcess-wide request deadline. Routes without #[Timeout] are
cancelled (worker freed) and answered 504 past this. ZERO
disables. Default 30s.
max_in_flight: usizeHard cap on concurrent in-flight requests — beyond it requests are
shed with 503 + Retry-After before any body is read (one atomic
counter, no locks). 0 = unlimited. Default 0.
max_body_bytes: usizeRequest body cap for every entry point. Default 8 MiB.
cache_max_entries: usizeCeiling on #[CacheTTL] store entries — the key includes the query
string, so an unbounded store is a memory-DoS vector. Default 10 000.
cache_sweep_interval: DurationHow often the cache sweeper reclaims expired entries. Default 30s.
ws_drain_deadline: DurationAfter a shutdown signal, WebSocket clients get this long to finish
before the server sends Close frames — otherwise live sockets keep
the HTTP drain (and therefore plugin on_shutdown) waiting until
the supervisor SIGKILLs. Default 10s.
cors: Option<CorsConfig>CORS policy. None (default) mounts no CORS layer at all.
shutdown_trigger: Option<Arc<Notify>>Programmatic shutdown trigger — notifying it behaves exactly like
receiving SIGTERM (drain flag, WS deadline, plugin hooks). Wired by
testing::TestServer::shutdown; production should keep None and
use real signals.
expose_docs: boolMount /docs (Swagger UI) and /openapi.json. Default true;
disable in hardened deployments that publish the spec elsewhere.
ws_outbound_buffer: usizePer-socket outbound queue depth — the slow-client memory ceiling; a
client that can’t drain it is evicted. Default 256.
ws_max_connections: usizeHard cap on concurrent WebSocket connections across all gateways;
beyond it upgrades get 503 before any socket exists. 0 =
unlimited. Default 0.
ws_ping_interval: DurationServer→client Ping cadence; pongs feed the idle sweeper. ZERO
disables. Default 20s.
adaptive_shed_target: DurationAdaptive latency shedding: when the EWMA of request latency exceeds
this target, a pressure-proportional slice of traffic is shed with
503 (capped at 90% so the EWMA can recover). ZERO disables.
Default ZERO (opt-in).
ws_idle_timeout: DurationReap sockets with no inbound activity for this long — dead TCP links
(NAT drops) never send Close and would linger forever. ZERO
disables. Default 60s.
Implementations§
Source§impl LaunchConfig
impl LaunchConfig
pub fn drain_budget(self, v: Duration) -> Self
pub fn request_timeout(self, v: Duration) -> Self
pub fn max_in_flight(self, v: usize) -> Self
pub fn max_body_bytes(self, v: usize) -> Self
pub fn cache_max_entries(self, v: usize) -> Self
pub fn cache_sweep_interval(self, v: Duration) -> Self
pub fn ws_drain_deadline(self, v: Duration) -> Self
pub fn adaptive_shed_target(self, v: Duration) -> Self
pub fn cors(self, v: CorsConfig) -> Self
pub fn shutdown_trigger(self, v: Arc<Notify>) -> Self
pub fn expose_docs(self, v: bool) -> Self
pub fn ws_outbound_buffer(self, v: usize) -> Self
pub fn ws_max_connections(self, v: usize) -> Self
pub fn ws_ping_interval(self, v: Duration) -> Self
pub fn ws_idle_timeout(self, v: Duration) -> Self
Sourcepub fn with_env_overrides(self) -> Self
pub fn with_env_overrides(self) -> Self
Apply ARCLY_* environment overrides on top of the coded values —
applied automatically by the launch path so operators can retune a
deployment (incident response, load tests) without a rebuild:
| Variable | Field |
|---|---|
ARCLY_REQUEST_TIMEOUT_MS | request_timeout (0 disables) |
ARCLY_MAX_IN_FLIGHT | max_in_flight (0 = unlimited) |
ARCLY_MAX_BODY_BYTES | max_body_bytes |
ARCLY_CACHE_MAX_ENTRIES | cache_max_entries |
ARCLY_WS_DRAIN_DEADLINE_MS | ws_drain_deadline |
ARCLY_DRAIN_BUDGET_MS | drain_budget |
ARCLY_EXPOSE_DOCS | expose_docs (true/false/1/0) |
Unparseable values are ignored with a warning — a typo must never change behaviour silently or stop the boot.
Trait Implementations§
Source§impl Clone for LaunchConfig
impl Clone for LaunchConfig
Source§fn clone(&self) -> LaunchConfig
fn clone(&self) -> LaunchConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LaunchConfig
impl Debug for LaunchConfig
Auto Trait Implementations§
impl Freeze for LaunchConfig
impl RefUnwindSafe for LaunchConfig
impl Send for LaunchConfig
impl Sync for LaunchConfig
impl Unpin for LaunchConfig
impl UnsafeUnpin for LaunchConfig
impl UnwindSafe for LaunchConfig
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more