It's a fact: “the next generation” of web apps aren't just extremely fast, they're highly scalable, as well. Which brings us to the next question: “How do you scale a web application in Drupal?”

What tools, best practices, and latest techniques do you use for leveraging Drupal 8's scalability capabilities?

For ensuring that your custom web app will keep on scaling to:
 

  • handle sudden spikes in traffic
  • avoid downtime 
  • withstand “surprise” content overloads
     

Well, here they come:
 

1. But Is Drupal Scalable? How Scalable? 

Let's just say that:

Drupal's built with scalability in mind and that Drupal 8 is... extremely scalable.

It's powering some of the world's most trafficked and content-rich websites (Weather, Grammy, Princess Cruises...). Therefore, it's designed to cope with heavy infrastructures of thousand content contributors, Drupal users and site/app visitors...

And when gauging Drupal 8's scalability you need to go beyond Drupal's unmatched modularity: +30,000 free modules.

Instead, just think of:
 

  • Drupal turned into a central API 
  • all the improvements brought to Drupal 8's scalability till this day
  • Drupal 8 enabling you, right out of the box, to integrate it with a wide range of third-party apps, software, and systems
  • RESTful API now in core!!!
     

… and how all that empowers you, the Drupal web app developer, to easily serve JSON or HTML code.

And Drupal 8's unparalleled scalability comes down to this:

Empowering developers to create content and send it to any third-party app via JSON.

Of course, its out-of-the-box scalability can get further optimized via:
 

  • an established set of best practices
  • additional support from various tools and technologies
     

2. How to Scale a Web Application in Drupal: Server Scaling Techniques

Let's say that... “it's time”:

You've applied all the optimization techniques on your web application so that it should seamlessly “accommodate” the increasing influxes of traffic and content load. And still, its server hardware has started to show its limitations.

So, it's time to scale your server hardware. And you have 2 options at hand:
 

2.1. You scale up your server vertically 

This is the handiest method, so to say. That “emergency” technique to go for when:
 

  1. you don't have time to install a caching module
  2. there's no one in your team with the needed expertise for adding more servers
     

So, what do you do? You increase your existing server size. 

You boost its performance by adding more resources.

This way, it could keep up with all those new traffic challenges calling for more memory, more CPU cores...

Word of caution: there' no such thing as “sky is the limit” here; you'll still reach the limit of the hardware at some point when you scale up a web app in Drupal using this method.
 

2.2. You scale up your server horizontally

The second best practice for scaling up your server is a bit more complex.

And it involves 2 approaches, actually:
 

a. You separate your database from your Drupal web app

Basically, your database will have its own server and thus you get to split the load in 2. Then, you can vertically scale each one of the 2 servers.
 

b. You add multiple servers and distribute the load between them.

This is the most complex way to scale a web app in Drupal. 

Just think about it:

How will the servers included in this whole “ecosystem” “know” which users to take over?

It goes without saying that you'll need a load balancer for properly “splitting up” the traffic load. And a database server, as well.

See? It already gets more complex compared to the other 2 above-mentioned server scaling techniques.

Nevertheless, this is the method which, when done properly, will reduce dramatically the load that each server must handle.
 

3. “Juggling with” Multiple App Servers for Drupal

Let's say that you've opted for the last method of scaling up your server, so:

Now you find yourself facing the challenge of handling multiple app servers.

How will you deploy code to each of them simultaneously? That is the biggest question when you scale a web app in Drupal.

The best practice is to keep all your servers on the same local network. 

Having one single data center will speed up the data transfer compared to having it traveling through the internet.
 

The END! This how you can leverage Drupal 8's scalability capabilities and easily “adjust” your web app to withstand unexpected surges of traffic.

Have you tried other techniques and best practices? 

Recommended Stories

5 Drupal Blog Posts in June with Useful and Valuable Content
Valuable, easy to navigate, useful and (most of all) usable content. This is the criterion that we use for… (Read more)
Adriana Cacoveanu / Jun 28 '2019
Drupal on Blockchain: Why Would You Want to Decentralize Your Drupal Network?
Just imagine: you update content on one of your Drupal websites and it gets automatically synchronized across your… (Read more)
RADU SIMILEANU / Jun 28 '2019
What Are the Most Famous Node.js Applications? 4 Large Scale Apps Built with Node.js
"What are some of the biggest companies using Node.js?" Some Node.js applications trafficked by... millions of… (Read more)
Adriana Cacoveanu / Jun 25 '2019