pub struct ColdStartOptimizer { /* private fields */ }Expand description
冷启动优化器(v7.0.0)
Serverless 场景下冷启动事件触发时,并行预热连接池至最小容量, 保证 P95 ≤ 150ms。超时时返回部分可用状态,后台继续预热。
Implementations§
Source§impl ColdStartOptimizer
impl ColdStartOptimizer
Sourcepub fn target_latency(&self) -> Duration
pub fn target_latency(&self) -> Duration
目标延迟
Sourcepub fn min_prewarm_connections(&self) -> u32
pub fn min_prewarm_connections(&self) -> u32
最小预热连接数
Sourcepub fn on_cold_start(&self) -> ColdStartStats
pub fn on_cold_start(&self) -> ColdStartStats
冷启动事件触发
并行预热连接池至最小容量,超时返回部分可用状态。
Sourcepub fn p95_latency(&self) -> Duration
pub fn p95_latency(&self) -> Duration
记算 P95 延迟
Sourcepub fn record_latency(&self, latency: Duration)
pub fn record_latency(&self, latency: Duration)
记算并更新 P95 采样
Sourcepub fn cold_start_count(&self) -> u64
pub fn cold_start_count(&self) -> u64
冷启动触发次数
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ColdStartOptimizer
impl RefUnwindSafe for ColdStartOptimizer
impl Send for ColdStartOptimizer
impl Sync for ColdStartOptimizer
impl Unpin for ColdStartOptimizer
impl UnsafeUnpin for ColdStartOptimizer
impl UnwindSafe for ColdStartOptimizer
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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 more