A few days ago, I post an article about how to handle +9M request on a small EC2 instance with Laravel and, on Reddit, they said it's nothing. They said that any service is able to manage that amount of traffic easily.
Today, we're going to talk about my experience at Wallbox, where we handled over 455M requests per week in a PHP service done with Symfony, and over 725M requests per week in total.
Table of contents:
Wallbox is the leading supplier of smart EV chargers. Our chargers are connected to the internet 24/7, sending data to the backend every 3 seconds while charging and every 9 seconds when idle.
Our mobile and web apps provide users with real-time information, configuration changes and the ability to make any action or request.
Wallbox receives approximately 455 million requests per week in a single service and 725 million requests per week in all their services combined.
You must have the right tools to monitor your application's performance. You need to be able to monitor the performance of your instances, the CPU and memory usage, and disk space. You also need proper logs to know what's happening and to discover and fix errors. Without the proper logs, each error could be a huge problem.
Without proper alerting, you won't be able to identify when something isn't working properly.
In Wallbox, we track and log every request. If we start receiving fewer requests from chargers, for example, an alert is triggered, we'll check the logs to see what's going on.
Don't even think about handling that many requests in the foreground. You need background processes, queues, and messages/jobs.
With Laravel, you can use something as simple as a cron job and a MySQL database. However, when you need to scale, you will need something more powerful, such as AWS SES and SQS.
You must be able to trigger events and messages and perform background processes. It could be as simple as sending an email or creating or updating a resource.
Queues and messages are superpowerful because they allow you to scale. You can have as many background processes as you need, and you will see all the errors in your error queues. You can also retry and manage them again.
You must start thinking about how to split your use case into multiple asynchronous background jobs instead of doing everything during the same request.
Making your CD/CI fast and efficient is not going to help you improve performance and respond to more requests, but when the traffic you handle is so high, it becomes critical.
Sometimes we make small features or fixes that without realizing it were slightly worsening performance and we would instantly see, thanks to the monitors, that the machines were starting to saturate.
At that moment we could revert the changes and in a matter of seconds, the machines would return to the previous state without affecting our users. Then, thanks to the logs, we could see what had happened, adjust the RM, and bring it back up with more peace of mind.
This was day to day, no matter how many tests we had, it was impossible to predict the behavior of a change when processing +725 requests per week.
When you have few requests you can afford to have some slow queries, but when you work with high amounts of traffic it is important to optimize them.
One of the things that worked best for us was creating projections.
These projections were something similar to a view. Instead of making complex and slow queries, with several joins, we create and maintain a projection, using events.
This projection is a table where we have the data ready to consume as we need it and queries go from slow to instantaneous.
Of course, before getting to this point, it is important to have a good queuing and event system, as well as logs and monitors. It can become impossible to know why a projection is out of date if you don't have these points previously covered.
Do you own a company or need help with your Laravel project? I can help you with that. Check the plans and let me know if you have any questions.
Get 1 month free with yearly plan during checkout.
$ 3 ,995
/m
What's included:
$ 5 ,995
/m
What's included:
Ok, just book a call now.
Good question! For starters, the annual cost of a full-time senior-level developer now exceeds $100,000, plus benefits (and good luck finding one available).
Aside from that, you may not always have enough work to keep them busy at all times, so you're stuck paying for time you aren't able to utilize.
With the monthly plan, you can pause and resume your subscription as often as you need to ensure you're only paying your developer when you have work available for them.
No, once subscribed you're able to request as many things as you'd like, and they will be delivered one by one.
Delivery will always be fast without compromising quality. Very complex requests will be divided into smaller products for continuous delivery.
Always, before starting to work, we can make a planning so that you know, before starting, when each change will be delivered.
You'll work directly with me, the founder and only person behind DeveloperJoy.
We understand you may not have enough work to fill up entire month. Perhaps you only have one or two requests at the moment. That's where pausing your subscription comes in handy.
Billing cycles are based on 31 day period. Let's say you sign up and use the service for 21 days, and then decide to pause your subscription. This means that the billing cycle will be paused and you'll have 10 days of service remaining to be used anytime in the future
I had experience making products with PHP, Go, and JavaScript/TypeScript.
Also I feel really comfortable working with WordPress, Laravel, Symfony, Vue.js, React, Svelte, and more.
Mail me and we will see how best to collaborate.
You can make this request by email, sharing a task board with me or, depending on your plan, by call or Slack.
That's fine. You can pause your subscription when finished and return when you have additional requests needs. There's no need to let the remainder of your subscription go to waste.
Due to the high quality nature of the work, there will be no refunds issued.