Expand description
§poolsim-core
poolsim-core is the Rust library crate for connection-pool sizing.
It is the simulation and analysis engine behind the poolsim workspace.
§Scope
The current release focuses on sizing calculation, not runtime pool enforcement.
It provides:
- workload and pool validation
- latency distribution fitting
- Erlang-C helpers
- Monte Carlo queue simulation
- pool-size optimization
- sensitivity analysis
- step-load analysis
§Install
[dependencies]
poolsim-core = "0.1.0"§Primary APIs
Use the crate-root APIs for the most common workflows:
simulate: full recommendation workflowevaluate: score a fixed pool sizesweep: generate sensitivity rows with default optionssweep_with_options: generate sensitivity rows with explicit options
Important public modules:
poolsim_core::typespoolsim_core::distributionpoolsim_core::erlangpoolsim_core::monte_carlopoolsim_core::optimizerpoolsim_core::sensitivitypoolsim_core::error
§Example
use poolsim_core::{
simulate,
types::{PoolConfig, SimulationOptions, WorkloadConfig},
};
let workload = WorkloadConfig {
requests_per_second: 220.0,
latency_p50_ms: 8.0,
latency_p95_ms: 32.0,
latency_p99_ms: 85.0,
raw_samples_ms: None,
step_load_profile: None,
};
let pool = PoolConfig {
max_server_connections: 120,
connection_overhead_ms: 2.0,
idle_timeout_ms: None,
min_pool_size: 3,
max_pool_size: 24,
};
let report = simulate(&workload, &pool, &SimulationOptions::default()).unwrap();
assert!(report.optimal_pool_size >= 3);§Output
The main simulation output includes:
- recommended pool size
- confidence interval
- cold-start minimum pool size
- utilisation ratio
- queue-wait metrics
- sensitivity rows
- optional step-load analysis
- warnings
§See Also
- Workspace repository: https://github.com/gregorian-09/poolsim
- Detailed library guide: https://github.com/gregorian-09/poolsim/blob/main/docs/library-api.md
- Sizing calculator guide: https://github.com/gregorian-09/poolsim/blob/main/docs/sizing-calculator.md
§Notes
- For CLI usage, see the
poolsim-clicrate. - For HTTP and WebSocket usage, see the
poolsim-webcrate.
Re-exports§
pub use types::DistributionModel;pub use types::QueueModel;pub use types::RiskLevel;
Modules§
- distribution
- Distribution fitting and sampling utilities. Distribution fitting and sampling for workload latency inputs.
- erlang
- Erlang-C queueing formulas. Erlang-C queueing helpers used by sizing and sensitivity calculations.
- error
- Error type and helpers.
Error types and helpers for the public
poolsim-coreAPI. - monte_
carlo - Monte Carlo queue simulation engine. Monte Carlo queue simulation primitives.
- optimizer
- Pool-size optimization routines. Pool-size optimization routines.
- sensitivity
- Sensitivity analysis routines. Sensitivity analysis across a configured pool-size range.
- types
- Public input/output data models.
Public data models used by
poolsim-core.
Constants§
- MIN_
FULL_ SIMULATION_ ITERATIONS - Minimum iteration floor used by full simulation for stable estimates.
- PERFORMANCE_
CONTRACT_ WARNING - Performance warning text emitted by benchmark/helpers when threshold is exceeded.
Functions§
- emit_
performance_ contract_ warning - Emits the performance contract warning when elapsed time exceeds threshold.
- evaluate
- Evaluates a fixed pool size against the workload/options.
- simulate
- Runs full pool-size optimization and returns a simulation report.
- sweep
- Generates a sensitivity table using default simulation options.
- sweep_
with_ options - Generates a sensitivity table using explicit simulation options.