Home
Solutions
Pricing
Developers
Blog
Company
+91 91610 19161 WhatsApp
Create account Login
  1. Home
  2. Blog
  3. Engineering

When everyone recharges at once: planning for traffic spikes

EngineeringPublished Updated 5 min read
Traffic graph spiking above a dashed daily limit line behind the words The Rush

Written by the A1 Plan API team, who build and run the API described here.

Every recharge platform has a day it remembers. A festival evening, a viral message about prices going up, the last day of the month. Traffic that was a gentle stream becomes a wall. If you have not met one yet, you will, and it is far easier to prepare on a quiet afternoon.

Step one: notice what repeats

On a spike day, thousands of customers do almost the same thing. They enter a number, you detect the operator and circle, and you show the plans. Hundreds of them share the same circle. That repetition is your friend, because it means most of the traffic can be answered from memory.

Step two: cache the shared parts

A plan list depends on the operator and the circle, not on the customer. Cache it for a few hours (shorter if prices are moving) and a thousand customers become one API call. We go through the details in caching and daily limits. Personal results, such as an R-offer for one specific number, should not be shared between customers.

Step three: do not retry in a panic

When things get slow, naive code retries immediately, which doubles the load exactly when you can least afford it. Retry once after a short pause, then give up politely. The reasoning is in our retry guide.

Step four: decide what “limit reached” looks like

If you use a subscription with a daily limit, think about what your customer sees at the limit. Options, from best to worst:

  1. Show the last cached plan list with a small “updated earlier today” note.
  2. Let the customer enter a plan amount manually.
  3. Show a friendly message and ask them to try again shortly.
  4. Show a raw error. Please do not.

You can try the real error path without waiting for a spike. In the sandbox, the password limit returns a “Daily limit reached” response on purpose.

Step five: check you have the right plan

If you hit your limit every month-end, the fix may not be code. It may be a bigger plan for the busy week. Our plan comparison helps you work out where you sit.

A small rehearsal

Before the next busy day, run a simple test: pretend your cache is empty and fifty customers arrive in one minute. What happens to your screen? If the answer is “it works but is slow”, you are in good shape. If the answer is “errors everywhere”, you now know what to fix first.

Frequently asked questions

What causes recharge traffic spikes?

Rumours or announcements of price hikes, festival offers, salary week and the last days of the month. People recharge early when they think prices will go up.

What is the cheapest way to reduce API calls?

Cache plan lists by operator and circle for a short time. Thousands of customers on the same circle need the same plan list.

What should I show when I hit my daily limit?

A friendly message and, where possible, the last cached plan list marked as such. Never a raw error.

Ready to build?

Create an account, pick a plan and make your first call today. Every plan includes every endpoint.

Create account Read the docs

Keep reading