Monday morning, March 16, 2020: schools have been closed and curfews are being discussed. On our Grafana dashboard, though, a different movie is playing: the volume of messages coming in from devices has grown 40 percent in a week. By mid-April we were at three times the previous year. The reason was actually simple: once everyone was shut in at home, home delivery exploded; half of our customers ran delivery fleets, and all of them were renting vehicles and growing their fleets at the same time. Our capacity plan assumed 30 percent annual growth. We absorbed three years of growth in six weeks.
This post is the log of that period. It isn't a hero story; it's a rundown of the bottlenecks that blew up one after another and what we learned from each one.
Week 1: A Swelling Queue and the First Misdiagnosis
The first alarm came from message processing latency: the time it took for a location sent by a device to show up on the map had gone from 2 seconds to 40 seconds. 1.2 million unprocessed messages had piled up in the queue. The first reflex was the classic one: "Add more workers." We did, and latency got worse. The bottleneck wasn't the workers; it was the database they all wrote to. Adding workers was like adding cars to the line at a jammed toll booth; it only increased lock contention. The real fix was to switch the workers to batch writes: instead of INSERTing messages one by one, write them in groups of 200 with a single query. Write throughput quadrupled, and the queue drained in two hours. Lesson one: before deciding to scale, prove where the bottleneck is. Let the wait statistics do the talking, not the output of top.

Weeks 2-3: The Disk's Silent Revolt
Once the queue was fixed, we thought we could relax; a week later, report queries started crawling. CPU normal, memory normal, but in iostat the await values had climbed from 2 ms to 30 ms. We were hitting the IOPS ceiling on the disks of our virtual machines in the data center: three times the data meant three times the writes and three times the load from the nightly summary job, and all of it was eating from the same disk quota. In the short term we made two moves: we moved the binlog and InnoDB log files to a separate disk, and we set innodb_flush_log_at_trx_commit to 2 for the telemetry database (we knowingly accepted the risk of losing the last second of data for location data; this isn't money data). await dropped to 8 ms. The permanent fix came at the end of the month: moving to a physical server with local NVMe. Cloud flexibility is nice, but in 2020 in Istanbul, a dedicated machine with NVMe gave you ten times the IOPS for the same money.
Week 4: The max_connections Wall
In early April, in the middle of the evening order surge, a downpour of "Too many connections" began. While scaling out the API servers horizontally, we hadn't accounted for the fact that every new PHP-FPM worker opens a MySQL connection while there was still only one database. The application layer stretches; the database's connection table doesn't. That night we saved the day by raising max_connections from 500 to 1,200; the permanent fix was connection pooling and worker budgeting, which deserves a post of its own (and I wrote one; search for the anatomy of connection pool exhaustion). Lesson three: every horizontally scaled layer multiplies the resources it opens on the layer that doesn't scale.
During the same weeks we also split off the read load. Reporting queries and live write traffic were wrestling each other on the same machine; we set up a read replica and routed the reporting engine entirely to it. We learned about the trap here the hard way, too: replication lag could reach 20-30 seconds at peak hours, and complaints started coming in along the lines of "the vehicle I just added isn't in the report." The fix wasn't exactly elegant, but it worked: we put a small "data is current as of" note on the report screen showing the replica lag, and if the lag went past 60 seconds, we fell back to running queries on the primary. In distributed systems, honesty is often cheaper than consistency.
Weeks 5-6: The Human Bottleneck and Cheap Wins
Toward May the system fires were out, and human processes took their turn. New customer activation was done by hand: device setup, vehicle pairing, user creation. The operations team, which normally handled 3-4 activations a week, was crushed under 30 requests a week. With a two-day internal tool, we hooked activation up to a self-service form. That item had sat on our technical debt list for two years, and it turned out to be the highest-return "scaling" work of all. Lesson four: the bottleneck isn't always in the machine; processes are subject to queueing theory too.
Let me put the activation tool's impact in numbers: operations time per activation dropped from 45 minutes to 6 minutes, the backlog of pending requests was cleared in two weeks, and we didn't lose a single new customer that quarter. The most boring code written in the middle of the crisis turned out to be the code that protected the most revenue.
While I'm at it, here's the rundown of cheap wins, because together they add up: three heavy dashboard queries put into the query cache (they were running 400 times a minute and nobody had noticed), API responses being returned uncompressed (with gzip, the average response shrank to a fifth), and two customer-specific tables still holding data older than 90 days in the main table. None of them was an architectural change; together, the three gave back 20 percent of peak load.

The Autoscaling Dream and the 2020 Reality
Some people said, "If you'd put it on Kubernetes, it would have scaled automatically," and we debated it ourselves back then. We didn't go that way, for two reasons. First, none of our bottlenecks were in the stateless layer: cloning API servers was already easy; what kept sinking was always the database, the disk and the persistent connections, and no autoscaler can save those. Second, telemetry load is actually predictable: the number of devices grows by contract, and traffic follows the sun (the 7:00 a.m. and 6:00 p.m. peaks never fail). What we needed wasn't magic that reacts within seconds but the right capacity decisions on a weekly horizon. The simple model we built back then (messages/sec per device, write cost per message, IOPS per write) served us better than Kubernetes in every growth decision that followed.

There's also the human-communication side of all this, which doesn't make it into the technical log. During the crisis weeks we told customers nothing, and that was a mistake: operations managers who noticed the delays jammed the support line, the support team started interrupting the engineers, and the engineers slowed down, a self-reinforcing loop. In mid-April we set up a simple status page and started writing two sentences there whenever there was a delay. Support calls were cut in half immediately. A nickel's worth of transparency turned out to be worth two servers.
In June we looked back and assessed the damage: over six weeks, one 40-minute partial outage (that max_connections night), three delays longer than 10 minutes, and zero data loss. Not a report card to be ashamed of; but the most critical finding was this: the warning signs of every problem we ran into were on the graphs weeks before the crisis. The daily peak of queue depth, the slow climb of disk await, the utilization ratio of the connection count... all of them had been climbing steadily since early March, and because they weren't wired to alerts, nobody was looking. A metric with a graph but no alert is like an insurance policy you never activated: the paper exists, the protection doesn't. Now every Monday we have a half-hour meeting looking at four capacity graphs, and that meeting is the cheapest insurance I've ever had.
If your fleet, your traffic or your customer base is growing unexpectedly and you want to figure out what will break first, leave us a message; bottleneck fortune-telling is more convincing when you hear it from someone who has lived through tripled growth.