# Simple Simulations for System Builders

DevFeed: [Simple Simulations for System Builders](<https://devfeed.tech/articles/simple-simulations-for-system-builders-12518.md>)

Original publisher: [Read original article](<http://brooker.co.za/blog/2022/04/11/simulation.html>)

Author: Marc Brooker

Published: 2022-04-11T00:00:00Z

Content type: article

Language: en

Sources: [Marc Brooker's Blog](<https://devfeed.tech/sources/marc-brooker-s-blog.md>), [Marc Brooker's Blog](<https://devfeed.tech/sources/marc-brooker-s-blog-2.md>)

Topics: [Formal methods](<https://devfeed.tech/topics/formal-methods.md>), [systems](<https://devfeed.tech/topics/systems.md>), [Simulation and Design](<https://devfeed.tech/topics/simulation-and-design.md>), [Python](<https://devfeed.tech/topics/python.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [Code](<https://devfeed.tech/topics/code.md>), [Hardware](<https://devfeed.tech/topics/hardware.md>), [Network](<https://devfeed.tech/topics/network.md>), [Availability](<https://devfeed.tech/topics/availability.md>)

Tags: [availability](<https://devfeed.tech/tags/availability.md>), [cost](<https://devfeed.tech/tags/cost.md>), [customers](<https://devfeed.tech/tags/customers.md>), [formal-methods](<https://devfeed.tech/tags/formal-methods.md>), [hardware](<https://devfeed.tech/tags/hardware.md>), [latency](<https://devfeed.tech/tags/latency.md>), [model](<https://devfeed.tech/tags/model.md>), [network](<https://devfeed.tech/tags/network.md>), [prototyping](<https://devfeed.tech/tags/prototyping.md>), [python](<https://devfeed.tech/tags/python.md>), [queuing](<https://devfeed.tech/tags/queuing.md>), [scale](<https://devfeed.tech/tags/scale.md>), [simulation](<https://devfeed.tech/tags/simulation.md>), [simulator](<https://devfeed.tech/tags/simulator.md>), [systems](<https://devfeed.tech/tags/systems.md>)

## AI overview

This article explains how simple, readable simulations can help system builders investigate properties that formal methods do not directly address, such as latency, cost, hardware needs, network sensitivity, availability, and overload behavior. It presents a Python ski-lift simulator as an example and shows how a small model can produce useful, counterintuitive insights.

## Source excerpt

Simple Simulations for System Builders Even the most basic numerical methods can lead to surprising insights. It's no secret that I'm a big fan of formal methods. I use P and TLA+ often. I like these tools because they provide clear ways to communicate about even the trickiest protocols, and allow us to use computers to reason about the systems we're designing before we build them1. These tools are typically focused on safety (Nothing bad happens) and liveness (Something good happens (eventually))2. Safety and liveness are crucial properties of systems, but far from being all the properties we care about. As system designers we typically care about many other things that aren't strictly safety or liveness properties. For example: What latency can customers expect, on average and in outlier cases? What will it cost us to run this service? How do those costs scale with different usage patterns, and dimensions of load (data size, throughput, transaction rates, etc)? What type of hardware do we need for this service, and how much? How sensitive is the design to network latency or packet loss? How do availability and durability scale with the number of replicas? How will the system behave under overload? The formal tools we typically use don't do a great job of answering these questions. There are many ways to answer them, of course, from closed-form analysis3 to prototyping. One of my favorite approaches is one I call simple simulation: writing small simulators that simulate the behavior of simple models, where the code can be easily read, reviewed, and understood by people who aren't experts on simulation or numerical methods. A Quick Example If you hang around with skiers or snowboarders, you'll have heard a lot of talk over the last couple of winters about how crowded resorts have become, and how much time they now spend waiting to ride the ski lift4. Resort operators say that visits have been up only quite modestly, but skiers are seeing much longer waits. Is somebo