1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! # Scalability Module for High-Volume Processing
//!
//! This module provides infrastructure for handling large-scale Modbus simulations:
//!
//! - **10,000+ concurrent connections** via sharded connection pooling
//! - **100,000+ TPS** via batch request processing
//! - **Backpressure management** via resource limiting
//! - **Performance profiling** for optimization and benchmarking
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────────────────┐
//! │ Scalability Module │
//! │ ┌────────────────────┐ ┌────────────────────┐ ┌────────────────────────┐ │
//! │ │ ShardedConnPool │ │ BatchProcessor │ │ ResourceLimiter │ │
//! │ │ - 64/128 shards │ │ - Request batching │ │ - Memory limits │ │
//! │ │ - Lock-free ops │ │ - Parallel exec │ │ - Connection limits │ │
//! │ │ - O(1) lookup │ │ - Coalescing │ │ - Rate limiting │ │
//! │ └────────────────────┘ └────────────────────┘ └────────────────────────┘ │
//! │ │ │
//! │ ┌────────────────────┐ │ ┌────────────────────────┐ │
//! │ │ PerformanceProfiler│◄─────┘ │ ScalabilityConfig │ │
//! │ │ - Latency tracking │ │ - All tuning params │ │
//! │ │ - TPS measurement │ │ - Preset profiles │ │
//! │ │ - Resource usage │ │ - Dynamic adjustment │ │
//! │ └────────────────────┘ └────────────────────────┘ │
//! └─────────────────────────────────────────────────────────────────────────────┘
//! ```
//!
//! ## Usage
//!
//! ```rust,ignore
//! use mabi_modbus::scalability::{
//! ScalabilityConfig, ShardedConnectionPool, BatchProcessor,
//! ResourceLimiter, PerformanceProfiler,
//! };
//!
//! // Use preset for 10K connections
//! let config = ScalabilityConfig::for_connections(10_000);
//!
//! // Create sharded connection pool
//! let pool = ShardedConnectionPool::new(config.connection_pool);
//!
//! // Create batch processor for high TPS
//! let processor = BatchProcessor::new(config.batch);
//!
//! // Create resource limiter for backpressure
//! let limiter = ResourceLimiter::new(config.resources);
//! ```
//!
//! ## Performance Targets
//!
//! | Metric | Target | Critical |
//! |---------------------|--------------|--------------|
//! | Concurrent Conns | 10,000+ | 50,000+ |
//! | TPS (throughput) | 100,000+ | 500,000+ |
//! | p99 Latency | < 10ms | < 50ms |
//! | Memory (10K dev) | < 2GB | < 8GB |
// Re-exports
pub use ;
pub use CoalescingConfig;
pub use ;
pub use ;
pub use ;
pub use ;