Essay - Published: 2024.01.02 | create | server-as-factory | software | system-design | tech |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
A good metaphor allows you to compress an idea such that you get a lot of leverage out of a little information. Software can often be hard to reason about because it seems to live under different rules than we're used to, thus making it hard to intuit.
In my years working as a software engineer I've seen many odd software decisions / conclusions that seem to be built on false assumptions about how software works. This is bad but it can be very hard to explain why these decisions are wrong without shared context on foundational assumptions.
So in this post we're going to explore a metaphor I've been toying with for thinking and reasoning about software servers - factories. I think it works pretty well and can serve as a 3S (Simple Scalable System) we can build on for further explorations of software principles.
Q: What is a good metaphor for thinking about software servers and their functions / constraints?
In this post we're exploring the metaphor of a Server as a Factory. It's a pretty minimal metaphor that has a lot of overlap across these domains and thus I believe works well for exploring many different scenarios.
In many ways a server is just a digital factory. We need something done, so we build some infrastructure to do it efficiently.

In its simplest form, a factory simply takes inputs and produces outputs. Servers running software are the same - just the inputs / outputs are usually virtual rather than physical.
We most often enlist Factories when we need to do things at scale. Some factories make raw materials, others use those materials to create complex Items, and still others just organize those Items for later distribution.
Servers are similar. If we can do something by hand, we usually don't build software to do that thing. But when we want to scale a process beyond humans, then we may opt for coding it. Some servers just make raw data (a time server for instance), others will fetch data from multiple places and process it into different derived data (most apps are CRUD), and still others are just there to make accessing / processing / sending that data easier and more efficient (think databases, caches, even many CRUD endpoints).
We'll use these similarities and various usecases to great effect for understanding different scenarios.
I'll caveat that this is not a perfect metaphor (we're flattening the 4d world of software into a sparse ~3d metaphor so obvs compression loss) but I think it can take us surprisingly far.
Okay so with the Factory as our stage, let's take a look at the actors we'll use to simulate the metaphor.

Factory - This is where all of our operations take place
Items - These are the things we're processing. Might be one thing, might be many things. These represent the inputs / outputs (and often there are intermediate Items that never leave the Factory).
Workers - These are the actors who do the work in the Factory - operating the Loading Docks, loading the Trucks, processing Items, etc. Based on the Factory and configuration, there may be more / less Workers available.
Trucks - This is the only mode of transportation / information passage. It could carry [0, many] Items and always has some sort of information to identify the Truck, the Items it carries, and its Request (what it wants).
Loading Docks - This is how we connect the Truck and the Factory. There are no doors in our Factory, only Loading Docks. Each Loading Dock must be operated by a Worker for it to operate. If there are no Loading Docks available the Truck must either wait or go away.
Okay so we've talked about a lot of different Actors in our metaphor but where does the software fit in? Well the software isn't really the server so it makes sense it's not one of our Actors - this is why system design / software design are similar but different.
In our case the software we're running on the server is the instructions we give the Actors in our Factory telling them what to do and how to do it. In Factory land you could think of it as the runbook for how each Worker should do a task:
We will explore different cases like these based on this Server as Factory metaphor in the future but for now let's finish defining the Factory.
With our Server as Factory defined, let's run through a simple Request to see how it works in practice.
For this example, we're going to keep things very simple:

In Factory land, handling a Request like this is like:
In Server land, handling a Request like this is like:
That's it - a simple request handled by our Server as Factory.
I've got a lot of ideas for different scenarios to leverage this metaphor in but I wanted to share the metaphor out first to get feedback. Let me know if you like the metaphor / have suggestions for improving it.
If you liked this post, you might also like:
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.