The `Backend Service` subsystem simulates a server's operational behavior, resource consumption, and performance. It is a critical part of the simulation, modeling how requests are processed and how server resources are utilized.
Components
ServerRuntime
The primary class that orchestrates the simulation of a backend server. It manages the server's lifecycle, resource allocation, request processing, and state reporting. This component acts as the central hub for all server-specific simulation logic.
Referenced Source Code
Request Dispatcher
An internal mechanism within `ServerRuntime` responsible for continuously monitoring the server's inbox for new requests. Upon receiving a request, it initiates a dedicated process for its handling.
Referenced Source Code
Request Handler
The core logic unit that simulates the processing of an individual request within the server. It models the consumption of CPU and RAM resources and introduces delays for both CPU-bound and I/O-bound operations.
Referenced Source Code
Resource Manager
Manages the server's available CPU and RAM resources, ensuring that requests acquire and release them appropriately during their processing. This is implemented using SimPy's resource mechanisms.
Referenced Source Code
Metrics Collector
Responsible for collecting and exposing various performance metrics related to the server's operation, such as the length of the ready queue, I/O queue, and total RAM in use.