Your first bottleneck
Find the limit of the Garage box, move the database to its own Node, and get the box off Burstable when its CPU credits run out.
In this lesson you find the Node that limits your Design, read why, and fix it. You fix two limits in the Garage: memory first, then CPU credits. Start from the Company you made in Your first Company.
Wait for the first limit#
Keep the game running and collect your revenue.
Watch the App Server card. At a few hundred users, its Load row jumps, and the row turns amber or red.
Look above the App Server. A BOTTLENECK tag appears, and the card has a pulsing outline.
The bottleneck is the one Node that costs you the most revenue now. See How requests flow for how the game finds it.
When the box is the bottleneck for the first time, the resize button at the bottom of its card glows. Do not click it yet. First, find out why the box is full.
Read the cause#
Select the App Server. The Inspector opens.
Read the red box under the title. It says Out of RAM and swapping: every request is slower.
Find the Resources section. The RAM gauge is full.
The App Server and PostgreSQL share one machine. The database keeps more data in memory as your users grow, so the box runs out of RAM. When a machine runs out of RAM, it moves memory to disk. This is called swapping, and it makes every request slow.
Watch the HUD. Apdex falls under its target, and the Users row shows a ▼. Users leave while you wait, so act now.
Move the database to its own Node#
Real companies take this step early: they give the database its own machine.
In the build dock at the bottom, select the Data group. You can also press its number key.
Select Database in the list. Its price shows at the right of the row.
Click the board to the right of the App Server. The Database card appears.
Find the blue output port on the App Server card.
Drag from that port to the Database card. A Link appears.
When you link the first box to a Database, PostgreSQL moves off the box for good. Select the App Server again. The red box is gone, and the RAM gauge is far from full.
Now watch the HUD for half a minute:
Apdex climbs back over its target.
Users shows a ▲ again.
The BOTTLENECK tag leaves the App Server, or no Node has it.
If you made a mistake, press Z to undo. An undo within 30 seconds refunds the full cost.
Wait for the second limit#
The App Server is a Burstable machine. It earns CPU credits while it is idle, and it spends them when it works hard. When the credits run out, the box runs at a small fraction of its CPU.
Keep the game running. Collect your revenue.
Select the App Server from time to time. Watch the CPU credits gauge in Resources. It falls as your traffic grows.
When the gauge is empty, the Inspector shows Out of CPU credits: throttled to 20% CPU.
The Load row turns red, and the BOTTLENECK tag comes back to the App Server.
Leave Burstable#
Select the App Server.
Find the Instance section in the Inspector. It shows four families: Burstable, General, Compute, and Memory.
Select General.
If a Tradeoff card opens, read its preview and select Confirm.
The box restarts for a short time, so its traffic drops for a moment. Then the CPU credits gauge is gone, and the Load row falls. A General box costs more per second than a Burstable one, but it never throttles.
You can also make the box bigger. Select Larger in the Instance section, or press U with the Node selected. A larger box has more CPU and RAM, and a higher price. This is vertical scaling.
Practice#
Two guided Sandboxes repeat this lesson on a fixed board:
What you learned#
The BOTTLENECK tag marks the Node that limits your revenue.
The Inspector's Resources section shows which resource is full.
A shared box runs out of RAM. A Database Node of its own fixes it.
A Burstable box runs out of CPU credits. The General family fixes it.
Next: read How requests flow, then go on to Your first incident.