Introducing Dragonfly Cloud! Learn More

Question: How can Redis be vertically scaled?

Answer

Vertical scaling, also known as "scaling up", is a method of adding resources such as more memory or additional CPU power to boost performance. When it comes to Redis, vertical scaling means that you augment the server's capacity where Redis instances are running.

In order to scale Redis vertically, there are several strategies you could consider:

  1. Upgrade your hardware: The most straightforward way to scale Redis vertically is by upgrading the machine where it runs. This might mean increasing RAM, improving the CPU, or switching to faster storage. Here's an example:
# Stop the current Redis instance service redis-server stop # Upgrade your server (this step will depend on your provider) # Usually involves selecting larger instance/machine type, applying change, and waiting for the restart # Start Redis back up service redis-server start
  1. Optimize your configuration: You can also scale vertically by modifying the Redis configuration to better take advantage of your existing resources. For instance, you may adjust maxmemory-policy, hash-max-ziplist-entries, and other parameters in 'redis.conf' file:
# Open the Redis configuration nano /etc/redis/redis.conf # Find the setting you want to adjust # Set the 'maxmemory-policy' to control how Redis handles memory usage above 'maxmemory' maxmemory-policy noeviction # Save and exit # Then restart the Redis service service redis-server restart

Remember that vertical scaling has its limitations - at some point, you won't be able to add more resources to a single machine. In this case, you'll need to consider horizontal scaling, which involves adding more machines to your setup.

It's also worth noting that while vertical scaling can improve performance, it can also increase costs, potentially significantly. Therefore, you should carefully monitor the effects of scaling on both your system's performance and your budget to ensure you're achieving the desired improvements without overspending.

If you're looking for a Redis alternative that's more performant and scales vertically, have a look at Dragonfly.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.