How We Quadrupled The Throughput of Our Service

Last updated on Mar 28th, 2022 | 5 min

To be precise, our service is 4.8 times faster now!

After months of hard work, debugging, and deploying, we skyrocketed the throughput of our service, increasing the number of optimized pages per day from 900,000 to 4,300,000.

And in this article, I’ll go through the specific service improvements and optimizations that we applied to achieve these spectacular results.

Also, I’ll wrap things up by shedding some light on what enhancements you can expect from NitroPack in the near future. 

Let’s begin! 

What We Did to Jump from Thousands to Millions Optimized Pages per Day

It wasn’t easy, but it was worth it! 

From 900k to 4.3M optimized pages per day

Here are the three solutions that allowed us to boost NitroPack’s performance:

Improved The Communication Between Our Microservices

NitroPack is composed of microservices, and some of them utilize a custom protocol to communicate with each other. 

After a thorough examination, our dev team found a bug causing communication issues, which led to failed messages and internal service timeouts. 

This whole process of waiting for a timeout to be reached and resending the requests was slowing down our service.

The issue affected several of our features - Critical CSS, Minified JavaScript, Remove Unused CSS, and Adaptive Image Sizing. 

We deployed a solution that improved the connection and communication between our microservices, which inevitably boosted the performance of the entire service.
 

Adding Hardware and Fine-Tuning The Software For More Stable Service

Some of you may remember that at the beginning of this year, there was a short period of time when our service was unstable. 

The primary reason for this to happen was the bug fixes that we applied to our microservices.

After we improved their communication, our servers were able to execute more optimizations which increased the overall load on our infrastructure. 

It took us some time to finetune our system to work efficiently based on the new, increased CPU load. 

To tackle the situation, we increased our server capacity by 20%, resolved software inefficiencies, and optimized our algorithms.
 

Identifying and Fixing CSS Optimization Bugs

The hardest thing to identify was the one that had the biggest impact on NitroPack’s performance. 

In this case, this thing was a CSS-related bug. Due to its specificity, it took us some time to track it down as it was hard to reproduce it.

Similar to the communication problem, some of our CSS optimizations were reaching timeout, and they couldn’t execute properly.

We could see that something was leaking memory, but tracking this down was a true endeavor. After a rigorous investigation, we discovered that a certain type of input CSS would cause a very deep (in some cases infinitely deep) recursion causing the optimization processes to fail.

While this problem was directly affecting only ~1% of our users, it negatively impacted the entire system.

Finding and deploying a solution contributed to increasing the overall efficiency and stability of NitroPack.
 

What’s Coming Next

Achieving four times better results feels exceptional. At the end of the day, providing our customers with the best possible site speed optimization service is what drives us forward.

However, all of us at NitroPack see every success as a stepping stone that will allow us to get even better in the future.

We’re proud of our ability to learn fast and apply the gathered knowledge from previous lessons to get our service to the next level. 

In fact, we use all the hiccups along the way as a learning opportunity because once we solve them, we can further enhance our alerting systems and therefore take care of future inefficiencies and bugs in a faster manner.

With that being said, here are some of the improvements that we have in the pipeline:
 

More Efficient Optimization Process for Larger Websites

We’ve already started working on this one. We aim to rework the optimization process for websites with tens of thousands of pages. 

How are we going to make this process more efficient? 

We’re going to optimize the order in which the requests will be processed, starting with the pages that receive the most traffic and then all the rest.

The best part will be that this will happen automatically and will be updated live. As soon as a page starts receiving more traffic, its priority will immediately be increased to reflect that. When we launch this enhancement, the chances for a visitor to land on an unoptimized page will be even lower (currently this is ~10%).
 

Increasing The Throughput Even More

In terms of increasing the throughput of our service even further, we already have a detailed plan on how to achieve it. 

We’re constantly working on upgrading NitroPack’s infrastructure, and we believe that the improvements we have on our agenda will have a massive impact on our performance. 

While I cannot share more with you right now, you can follow our blog for the latest updates, subscribe to our newsletter, or join the NitroPack community.
 

Faster Re-optimization after Cache Purge

We’re currently testing some new features that will make the process of reoptimizing a website after cache purge much faster. Again, more information on that is coming soon.

As you can see, a lot is going on behind the scenes. And speaking of behind the scenes, if you want to keep up with all things NitroPack, you should definitely check NitroTalks - our video series where we share what we work on and what is to come.


And if you want to experience all of the upcoming improvements first, you should join our Speed Insiders

Niko Kaleev
Content Writer

Niko is one of the NitroPack storytellers. He is passionate about writing quality content and turning complex optimization concepts into engaging articles.