Overview
The SimulationBank API provides comprehensive metrics for analyzing simulation performance, including wait times, throughput, utilization, and queue statistics. Metrics are collected in real-time during simulation and can be retrieved via the/api/metrics endpoints.
Simulation Report
The primary metrics structure returned by GET /api/metrics/report.Schema
Unique identifier for the simulation run.
Total elapsed simulation time in seconds.Example:
14400.0 (4 hours)Total number of customers who arrived at the bank during the simulation.Note: Includes both served and rejected customers.
Total number of customers who successfully completed service.Formula:
customers_arrived - customers_rejectedNumber of customers rejected due to queue being at maximum capacity.Note: This metric indicates lost business and capacity issues.
Wait Time Metrics
Mean wait time across all customers (in seconds).Calculation: Average of
(service_start_time - arrival_time) for all served customers.Example: 45.3 secondsAverage wait times broken down by priority level.
Maximum wait time experienced by any customer.Example:
450.2 secondsMinimum wait time experienced by any customer.Example:
0.0 seconds (served immediately)Service Time Metrics
Mean service time across all served customers (in seconds).Example:
3.98 secondsMean total time in system (wait + service) in seconds.Formula:
average_wait_time + average_service_timeExample: 49.28 secondsQueue Metrics
Peak queue length observed during the simulation.Example:
23 customersNote: If this equals max_queue_capacity, customers were likely rejected.Time-weighted average queue length throughout the simulation.Calculation: Integral of queue length over time divided by total time.Example:
8.4 customersUtilization Metrics
Utilization rate (0.0 to 1.0) for each individual teller.Format:
{ "teller_id": utilization_rate }Example:Average utilization across all tellers (0.0 to 1.0).Calculation: Mean of all teller utilization rates.Example:
0.89 (89% utilized)Utilization above 0.90 (90%) often indicates the system is near capacity and may experience long queues.
Throughput Metrics
System throughput measured as customers served per unit time.Formula:
customers_served / total_simulation_timeUnits: customers per secondExample: 0.149 customers/second (≈8.94 customers/minute)System Health Metrics
Number of times the system became completely idle (all tellers idle with no customers waiting).Example:
3 incidentsFrequent starvation indicates low arrival rate or excess capacity. Rare starvation is normal.
Live Metrics
Real-time metrics returned by GET /api/metrics/live during an active simulation.Current simulation clock time in seconds.
Number of customers currently waiting in queue.
Number of tellers currently serving customers (status = BUSY).
Number of tellers currently available (status = IDLE).
Total customers served up to the current simulation time.
Total customers currently in the system (waiting + being served).
Customers served in the last time window.Units: customers per minuteExample:
8.94 customers/minuteWait Time Record
Detailed record for individual customer wait times (used internally for metrics calculation).Customer identifier.
Customer priority level (1, 2, or 3).
Time spent waiting in queue (seconds).
Time spent being served (seconds).
Total time in system:
wait_time + service_timeThroughput Record
Throughput measurement over a time interval (used for time-series analysis).Simulation time when the measurement was taken.
Number of customers served during this interval.
Number of customers rejected during this interval.
Example Complete Report
Key Performance Indicators
System Efficiency
Percentage of customers served (not rejected).Formula:
(customers_served / customers_arrived) × 100Target: > 99%Ratio of wait time to service time.Formula:
average_wait_time / average_service_timeInterpretation:- < 1.0: Wait time less than service time (good)
- 1.0-2.0: Moderate queue delays
-
2.0: Significant queueing issues
Variance in utilization across tellers.Interpretation: Low variance indicates balanced workload distribution.
Priority Fairness
Ratio between priority level wait times.Example:Interpretation: Shows effectiveness of priority queue system.
Metrics Best Practices
For reliable statistics, run simulations for at least 1000 customer arrivals or 2+ hours of simulation time.
Recommended Analysis
- Capacity Planning: Use
overall_utilizationandthroughputto determine if staffing is adequate - Service Quality: Monitor
average_wait_timeandwait_time_by_priorityto ensure SLA compliance - Resource Optimization: Compare individual
teller_utilizationto identify imbalances - Bottleneck Detection: Check if
max_queue_lengthapproachesmax_queue_capacity