The Day We Went Viral: Scaling LYKA to Millions Overnight
Part 1 of a series on building LYKA and scaling it to 30 to 50 million monthly active users.
Nobody plans for the day their app goes viral. We certainly didn't. It was our second year building LYKA, in the middle of the pandemic. Everyone was stuck at home on their phones, and we were growing at a steady pace. Then one influencer joined the app and bought a car, and in a single day we went from around a hundred thousand users to millions.
We thought we were ready. We had built LYKA to scale. We'd already moved fully to serverless, so in theory everything would scale on its own, and that was the whole reason we did it. We were about 30 people, mostly mobile and backend engineers, and we didn't have a dedicated infrastructure person because we didn't think serverless needed one.
The system did scale, technically. Just not in the ways we'd prepared for.
What broke
Serverless removes a lot of problems, but not all of them. When traffic multiplies overnight, you run into every bottleneck you didn't know about: the parts that don't scale automatically, limits you'd never hit before, and the bill. We were already spending around $100K USD, and that number started climbing in a direction nobody had budgeted for.
None of us slept much in those days. We watched dashboards and fixed things in production. At a few thousand users, a 100 ms delay doesn't matter. With millions hitting the system at once, those 100 ms add up. Requests queue, retries pile on top, and every user feels it.
A surge also isn't millions of people quietly browsing. It's millions of people downloading the app, opening it and creating an account at the same time. So registration failed first. Every new user has to go through it, and you can't cache your way around someone creating an account.
The rest of the app held up because we'd already split the system into separate pieces. New users don't have a personalised feed yet anyway, so we showed them the best cached content we thought was relevant to them, and it loaded fast. Once people got in, they spread out. Some went to games, some posted, some searched, some browsed the e-commerce side, and plenty went straight to claiming their gems. Each part scaled on its own, so one busy feature didn't starve the others.
The bottleneck was the gate, the entry point. Once the surge hit, that was obvious.
300,000 sign-ups in one go
We didn't hear about it from users first. Our telemetry was already shouting that the servers were slowing down, and every alert pointed at identity, the service that creates accounts and logs people in.
By then almost all of LYKA ran on serverless. Identity was the exception. It was the last item on our migration list and still ran on traditional servers, and we didn't expect it to be the thing that fell over. Then 300,000 people tried to create an account at once.
Social media doesn't grow in a smooth line. It sits flat for a while and then spikes. The serverless parts of our system stretched to handle the crowd, and the identity servers couldn't. Most people did get registered in the end, but it was painfully slow.
The hotfix
There was no clever trick.
First, we added hardware and increased the server capacity behind identity, because it was the fastest lever we had.
Second, we deliberately delayed registrations instead of letting everyone pile in and time out together.
Third, we put up banners telling people registration was paused or delayed, or that they were on a waiting list.
The banners mattered most. We decided it was better for people to know they were waiting than to sit on a slow screen wondering if the app was broken.
The lesson
We had moved almost everything to serverless, but the one door every new user had to walk through was still the old one. If you're planning a migration, think twice before leaving the front door for last. For us, the gate should have gone first.
What's next
Over the next few posts I'll cover what we learned taking LYKA from that spike to tens of millions of monthly active users:
- What serverless solved for us, and what it didn't
- How we kept LYKA Gems, our virtual currency, safe at that scale
- How we got cloud costs under control
- How a small team handled growth that would usually need a much bigger one
If you lead an engineering team and think your system is ready to scale, I hope this saves you a few sleepless nights. Next up: how we rebuilt identity so it would never jam again.
Comments
No comments yet. Start the discussion.