Managing 50K+ Redis Databases Over 4 Public Clouds with a Tiny DevOps Team
Join the DZone community and get the full member experience.Join For Free
originally written by yiftach shoolman
modern applications have a general list of needs in order to not only survive, but thrive in today’s fast paced cloud environment. these include low response times (less than 100 milliseconds), limitless scalability, high availability, and optimal performance, to name a few. with a selection of modern database options available, redis has proven to be one of the most popular. redis labs has aided in the creation of over 50,000 databases by over 2,500 paying customers, with more than 100 new databases created daily. being a major contributor to
redis’ open source project
, many of the use cases that we see using redis include social applications, online advertising companies, and gaming companies. our experience running redis services across the four major clouds (aws, azure, gcp and softlayer) has made us aware of a number of challenges that users encounter, which consequently led to our thoroughly tested solutions, a few of which we have shared below.
challenge #1: stable top performance
while redis is very fast, with the ability to respond to requests in less than 1 millisecond, running it in the cloud can cause performance to degrade significantly. however, with redis labs, all operations are performed behind the scenes, incorporating as many redis instances as possible into a cluster to enable pure multi-tenancy architecture without degraded performance. redis databases on our platform use master-slave replication, where the master is located on one node while the slave is located on another, with as many instances as possible on every node. additionally, the cluster is built around an odd number of nodes in order to have a quorum in case of a failure. our zero-latency proxy hides everything from the user's perspective, so that users only see a single-end point, with the ability to add proxy to receive more throughput, without visibility of shards, clusters or nodes.
challenge #2: data center selection
when we began our journey with redis, our primary challenge was understanding which data center would be optimal for each application. it is important that every redis database be run on the same data center as its respective application so as to avoid network latency. data centers are selected by users when they create an instance inside a region, however, an issue arises when selecting a zone or data center from aws, because they are mapped out differently between accounts. for example, redis labs’ ‘us-east-1a’ can be signified as ‘us-east-1c’ for other users. while these are completely different data centers, aws set up this method to ensure stable load balancing for its internal architecture. otherwise, since most users have no preference regarding a specific data center, most will choose the first one, thus creating an unbalanced level of demand. to deliver redis labs' multi-cloud, multi-region service from the closest location possible to the user’s application, we developed a code that performs mapping between our zones and those of our users. applying that to our example, we found that the code for ‘us-east-1a’ matched that of ‘us-east-1c’. this tells us that when a user chooses to create a database in ‘us-east-1c’, it should be mapped to our ‘us-east-1a’ to ensure minimal network latency.
challenge #3: instance selection
deciding which instance to select when creating a node can be confusing. consequently, we decided that any type of instance can be used in redis labs’ clusters. though each instance type has a predefined set, there is no limitation to the range of sizes that can exist within a cluster, whether it be 30gb or 200gb. this kind of flexibility is key. we want to be able to cope with high memory usage as well as high cpu usage. additionally, we want to run everything on dedicated infrastructure to avoid 'noisy neighbors' and be as cost effective as possible. using large instances automatically provides dedicated instances by design. these large instances are then used in creating our own controlled multi-tenant infrastructure. in order to create a solid infrastructure for any architecture, it is advised to use specific instances across the clouds: c3 (for performance) and r3 (for memory) in aws; a4, a5, a6, and a7 in azure; the standard high memory and high cpu in gcp; base clusters over bare metal servers in softlayer with added virtual machines to scale out.
challenge #4: data persistence
with users who run 1 million operations per second, 50% of which being write requests, data persistence is extremely significant with redis. the question is, how can this be performed over aws' ebs infrastructure? first of all, you need to understand the details behind the storage architecture of the cloud: local ephemeral storage is relatively fast and network attached storage, such as ebs, is persistent. the largest ebs volumes on aws provide dedicated ebs disk storage (the same goes for gcp). unfortunately, this is not enough to cope with redis' performance. as a result, we hybridized the two, using ephemeral for some storage needs, incorporated with ebs for persistence. accordingly, we have fine tuned redis to enhance its speed when accessing a disk, and use slaves to perform data persistence activities when using replication, freeing up the master.
challenge #5: monitoring
how is everything monitored? zabbix is used to monitor nodes, and as far as monitoring database metrics goes, we searched for an open source project to no avail, which led us to build our own monitoring system - limbic - that is based on python, rrd and redis. with this platform we are able to monitor 50,000 databases, each with 100 metrics, and keeping 10,000 time resolutions. in due time, it will be available on open source for everyone to enjoy.
how we manage the service
we are able to handle these complex infrastructures at the hand of our strong devops team that, while humble in size, is backed up by the devs who know the system inside and out, and can be dragged into resolving production issues in real time. we also use a 'baby steps' approach when moving to production. as a result, we always begin with manual configuration, then slowly make our way to automation. we've found that this practical approach always wins.
overall, redis labs has taken the necessary steps to ensure quality redis performance for our customers. our solutions to the challenges mentioned above have provided the peace of mind our customers need in order to successfully focus on their own core capabilities. for more information, check out the full video that explores the challenges above as well as the corresponding slide show .
Published at DZone with permission of Itamar Haber, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.