
Why Adding More Servers Can Make Your Database Slower
Adding more servers sounds like an easy way to improve application performance. But what happens when all those servers start sending requests to the same database? In this article, we will explore how database bottlenecks can affect application performance and how AWS services such as EC2, Amazon RDS, ElastiCache and CloudWatch can help address them.
Introduction
Imagine running an online shopping application.
Initially, everything works fine. Users can browse products, add items to their carts and complete purchases without much delay.
As the application becomes more popular, the number of visitors increases. Naturally, the first solution that comes to mind is to add more servers so that the application can handle more requests.
So, you increase the number of EC2 instances and distribute incoming traffic using an Application Load Balancer.
But something unexpected happens.
The application has more servers now, yet some pages are taking longer to load. Product searches are slower, requests occasionally time out, and users are experiencing delays while accessing their accounts.
If the application servers are no longer the main limitation, where is the problem?
One possible reason is the database.
This is an interesting part of cloud architecture that is easy to overlook. Increasing the capacity of one component does not automatically increase the capacity of every other component connected to it.
Let's understand why this happens and how we can approach it using AWS services.
1. Understanding the Database Bottleneck
First, let's understand how a typical web application works.
When a user opens an application, the request usually travels through multiple components.
For example:
- The user sends a request through a browser.
- The request reaches the application server.
- The application server communicates with the database if information is required.
- The database processes the query and returns the result.
- The application sends the response back to the user.
In a simple architecture, this might look like:
User → Application Server → Database → Application Server → User
Now imagine that hundreds or thousands of users are accessing the application simultaneously.
The application server needs to handle their requests, and many of those requests may also require database operations.
This is where a bottleneck can occur.
A database has limited resources, including CPU, memory, available connections and storage performance. If too many operations reach it at once, it may struggle to process them efficiently.
The application servers might be ready to handle more requests, but the database cannot keep up.
This is known as a database bottleneck.
2. Why Adding More Servers Can Make Things Worse
Let's consider a simple example.
Suppose an application initially runs on two EC2 instances connected to one Amazon RDS database.
Each application instance handles user requests and communicates with the database.
Now, traffic increases. We decide to scale the application from two instances to eight.
At first, this sounds like a good decision.
However, each additional application instance can create more database connections and send more queries.
For example, assume each application instance is configured to maintain a database connection pool of 20 connections.
Configuration | Potential connections |
|---|---|
2 EC2 instances | 40 |
4 EC2 instances | 80 |
6 EC2 instances | 120 |
8 EC2 instances | 160 |
These numbers are illustrative, not actual AWS benchmark results.
The important point is that increasing the number of application instances can increase the potential number of simultaneous database connections.
If the database has insufficient connection capacity or resources to handle the additional workload, requests may start waiting, slowing down, or failing.
Adding servers has increased the application's capacity to receive requests, but it has also increased pressure on the database.
This is why scaling the application layer without considering the database can create another performance problem.
3. Understanding the Role of Each AWS Service
Now let's look at how we can design an application architecture that considers both application capacity and database performance.
Amazon EC2
Amazon EC2 provides the compute capacity required to run the application.
Each instance can handle incoming requests, execute application logic and communicate with the database.
When traffic increases, additional instances can be launched to handle the workload.
However, adding more EC2 instances does not automatically increase the capacity of the database they connect to.
Application Load Balancer
An Application Load Balancer distributes incoming requests across registered targets, such as EC2 instances.
For example, instead of sending every request to one server, the load balancer can distribute traffic across multiple healthy instances.
This helps prevent one application server from handling all the incoming traffic.
However, the load balancer does not distribute database queries or increase database capacity. The application servers still depend on the database for operations that require stored information.
EC2 Auto Scaling
EC2 Auto Scaling adjusts the number of EC2 instances according to configured scaling policies.
For example, if application demand increases, the Auto Scaling group can launch additional instances.
When demand decreases, it can reduce capacity.
This helps the application adapt to changing traffic without permanently maintaining the maximum number of servers.
But there is an important consideration.
If the database is already under pressure, launching more application instances could increase the number of requests reaching it.
Auto Scaling should therefore be considered alongside database capacity and application behaviour.
Amazon RDS
Amazon RDS provides a managed relational database service.
It supports database engines such as MySQL, PostgreSQL, MariaDB, Oracle and SQL Server.
In our example, RDS stores information such as customer details, product information and orders.
As application traffic increases, the database workload may also increase.
Some possible ways to address database performance problems include:
- Choosing an appropriate database instance size.
- Optimising frequently executed SQL queries.
- Adding suitable database indexes.
- Monitoring database connections.
- Reviewing connection pool configuration.
- Considering read replicas for suitable read-heavy workloads.
The important thing is to identify the actual bottleneck before increasing database capacity.
Amazon ElastiCache
One way to reduce repeated database requests is caching.
Imagine that hundreds of users are requesting the same popular product information.
Without caching, the application might repeatedly retrieve the same information from the database.
Instead, frequently requested data can be stored in a cache.
Amazon ElastiCache provides managed caching using engines such as Redis OSS and Memcached.
The application can check the cache first. If the required information is available, it can return the cached result instead of querying the database again.
This is commonly known as a cache hit.
If the information is not available, the application retrieves it from the database and may store the result in the cache for future requests. This is commonly known as a cache miss.
Caching can reduce repeated database reads and improve response times for suitable workloads.
However, caching also introduces another consideration: data freshness.
If product information changes in the database, the cached copy must be updated or invalidated appropriately. Otherwise, users might see outdated information.
4. Understanding Read Replicas
Another approach is to separate certain read operations from write operations.
Consider an online shopping application.
Users may perform different types of operations:
Read operations:
- Viewing product details.
- Checking product availability.
- Viewing order history.
- Searching for products.
Write operations:
- Creating an order.
- Updating customer information.
- Changing product quantities.
In a read-heavy application, a large number of requests may be used to retrieve information.
Amazon RDS supports read replicas for supported database engines and configurations.
A read replica is a separate database instance that receives replicated data from the primary database and can handle suitable read-only queries.
Conceptually:
Application → Primary RDS Database
The primary database handles writes and other operations.
For suitable read queries:
Application → RDS Read Replica
This can distribute read workloads across additional database capacity.
However, read replicas are not a solution for every database problem.
They do not automatically improve write performance, and replication can introduce delays. Applications must also account for the possibility that recently updated information has not yet appeared on a replica.
Choosing between caching, read replicas and database optimisation depends on the actual workload.
5. How Do We Know Where the Problem Is?
One of the most important steps in solving a performance issue is identifying the component responsible for it.
Simply increasing server capacity without understanding the problem can waste money and make the architecture more complicated.
Amazon CloudWatch helps monitor AWS resources and collect relevant performance metrics.
For our application, we could monitor:
Component | What to monitor |
|---|---|
EC2 | CPU utilisation and network activity |
Application Load Balancer | Request count, response time and target health |
RDS | CPU utilisation, database connections and read/write activity |
ElastiCache | Cache hits, misses and memory usage |
For example, imagine the following situation:
- EC2 CPU utilisation is relatively low.
- Application requests are taking longer to complete.
- Database connections are increasing.
- Database CPU utilisation is also increasing.
This combination may indicate that the database is struggling to handle the workload.
It is important to investigate multiple metrics together rather than assuming that one metric explains the entire problem.
CloudWatch provides the visibility needed to investigate these issues.
6. A Practical Architecture

Let's bring everything together using our online shopping application.
The proposed architecture could look like this:
User → Application Load Balancer → EC2 Auto Scaling Group → Amazon RDS
We can improve this design by introducing additional components:
- Application Load Balancer distributes incoming requests.
- EC2 Auto Scaling adjusts application capacity.
- Amazon RDS stores persistent application data.
- Amazon ElastiCache stores frequently accessed information.
- RDS Read Replicas can handle suitable read-heavy workloads.
- Amazon CloudWatch monitors the performance of the different components.
The important part is that each service has a different responsibility.
Adding more EC2 instances addresses application compute capacity. Caching can reduce repeated database reads. Read replicas can distribute suitable read workloads. Database optimisation can reduce unnecessary processing.
These approaches solve different problems, so they should not be treated as interchangeable solutions.
7. What Should We Consider Before Scaling?
Before increasing the number of application servers, there are a few things worth checking.
1. Understand the workload
Is the application receiving more read requests or write requests? Does it frequently access the same information?
The answer can help determine whether caching or database optimisation would be useful.
2. Review database connections
Increasing application instances can increase the total number of potential database connections.
Connection pools should be configured carefully so that the database is not overwhelmed.
3. Identify expensive queries
Some queries may take longer because they retrieve too much information or do not use appropriate indexes.
Optimising these queries can sometimes provide more benefit than adding additional servers.
4. Consider caching
If the application repeatedly retrieves information that does not change frequently, caching may reduce unnecessary database requests.
5. Monitor before making changes
Use performance metrics to identify the actual bottleneck instead of changing infrastructure settings based on assumptions.
6. Consider the cost
More EC2 instances, larger RDS instances, read replicas and caching services all introduce additional costs.
The architecture should provide the required performance without introducing unnecessary resources.
8. The Bigger Lesson
The most important thing I took away from exploring this topic is that application performance cannot be understood by looking at servers alone.
An application is made up of connected components. Each component has its own capacity, limitations and responsibilities.
Increasing the capacity of one component may simply move the bottleneck somewhere else.
For example:
- Adding more EC2 instances may increase database connections.
- Adding a cache may introduce data consistency challenges.
- Adding read replicas may introduce replication delays.
- Increasing database capacity may increase infrastructure costs.
Every architectural decision comes with trade-offs.
This is why understanding how different services interact is just as important as knowing what each service does individually.
Conclusion
Adding more servers is a useful way to increase application capacity, but it does not guarantee better performance.
If the database cannot handle the additional workload, the application may continue to experience slow responses even after scaling the compute layer.
Services such as Amazon EC2, Application Load Balancer, Amazon RDS, Amazon ElastiCache and Amazon CloudWatch each play different roles in addressing these challenges.
The real goal is not simply to add more infrastructure. It is to understand where the limitation exists and choose the right solution for that particular problem.
Because a faster application is not always about having more servers. Sometimes, it is about making sure every component can keep up with the others.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article