Real-world systems are often too complex to test reliably, in the same environment and under the same conditions. Changes are hard to measure, edge cases are difficult to reproduce, and external influences can hide the real behavior of a system. Simulation offers a way to abstract from reality while staying close enough to produce meaningful results. It allows full control over system components, timing, and disruptions, and makes it possible to test many scenarios in a repeatable way.
The practical example of this talk focuses on simulating load-balancing algorithms. Load-balancers are a good example of systems that are hard to evaluate in real environments. Some tested algorithms have no existing implementation, others differ across platforms, and cloud environments introduce many uncontrollable factors such as network latency, cloud noise, and reoccurring background workloads. These factors make fair and consistent testing almost impossible.
The problem is addressed by building an event-based simulation using SimPy. The session explains how SimPy works by using Generators to create the events, and how time and processes interact inside a simulation. An architecture for a practical example for a load-balancer simulation is presented, showing how different components interact and how algorithms can be swapped and compared.
The talk also covers improvements made to the simulation, including a command-line interface for easier execution and a YAML configuration file for flexible setup. It concludes with practical tips and lessons learned when working with SimPy, helping to avoid common pitfalls and improve simulation design.
Overall, the session provides an introduction to simulation as a testing tool, a hands-on example using SimPy, and a realistic architecture for building and evolving simulations in Python.