The 1.2M Ops/Sec Redis Cloud Cluster Single Server Unbenchmark
Join the DZone community and get the full member experience.Join For Free
while catching up with the world the other day, i read through the high scalability guest post by anshu and rajkumar's from aerospike (great job btw). i really enjoyed the entire piece and was impressed by the heavy tweaking that they did to their ec2 instance to get to the 1m mark, but i kept wondering - how would redis do?
i could have done a full-blown benchmark. but doing a full-blown benchmark is a time- and resource-consuming ordeal. and that's without taking into account the initial difficulties of comparing apples, oranges and other sorts of fruits. a real benchmark is a trap, for it is no more than an effort deemed from inception to be backlogged. but i wanted an answer, and i wanted it quick, so i was willing to make a few sacrifices to get it. that meant doing the next best thing - an unbenchmark.
an unbenchmark is, by (my very own) definition, nothing like a benchmark (hence the name). in it, you cut every corner and relax every assumption to get a quick 'n dirty ballpark figure. leaning heavily on the expertise of the guys in our labs, we measured the performance of our redis cloud software without any further optimizations. we ran our unbenchmark with the following setup:
- a sharded 1 redis cloud in-memory nosql database server running on a single amazon instance (see my notes on sharding and redis cloud clusters below).
- 3,000,000 objects, each of size 100 bytes.
- the memtier_benchmark tool client run on a non-server instance using the following command line arguments: `--ratio=1:1 -n 1000000 -d 100 -t 1 -c 50 --pipeline=75 --key-pattern=s:s`.
- a workload that mixes reads and writes in equal proportions (we have no particular bias towards one operation type over the other and feel this mix better reflects real life).
- an on-demand c3.8xlarge instance.
we didn't have the time to set up a vpc and tune the placement groups for optimal performance, so we ran the entire thing in our standard service environment - i.e. on a noisy, crowded ec2 network. we also didn't tune the cpu behavior or the number of threads or the shards' configuration for this experiment - we let redis cloud use its defaults. we didn't test multiple network configurations or add additional elastic network interfaces (eni). we simply took a freshly provisioned redis cloud server on hvm and did the unbenchmark against it...
you can find the raw output from our run in this gist , but the bottom line is that it scored a little over 1.2 million tps (1228432 to be exact). naturally, this amazing result really whetted my appetite and i immediately asked for a full-blown, all-optimizations-included, exhaustingly-exhaustive, fruit-and-vegetable-inclusive benchmark to really see how much we can push the limits with redis! and guess what? it's in the backlog :)
1 some notes about sharding and redis cloud clusters (as promised):
by design, the redis server is (mostly) a single-threaded process. that being the case, sharding is usually employed to scale a redis database beyond the boundaries of a single cpu core or the ram capacity of a single server. there are three generally-accepted approaches for implementing sharding: client-side, proxy or clustering. since client-side and proxy-based solutions for sharding redis are easier to implement independently of the actual underlying database engine, these (e.g., redis-rb and nutcracker ) have been around for quite some time now. there are, however, only a few redis cluster solutions today.
a sharded redis cluster means a bunch of redis servers (processes) deployed over one or more compute nodes across a network. the cluster runs redis databases, each potentially spanning a number nodes and multiple cores, over an aggregated amount of ram. a production-grade cluster should also meet challenges such as ensuring the database's availability, as well as its performance and management of infrastructure and database resources.
the best known implementation of a redis cluster is, naturally, that of the open source's. redis cluster (v3) is already in advanced stages of beta and it is expected to be production-ready within months. this upcoming version will provide excellent answers to many of the challenges i mentioned. among its many new features, the new oss version also includes the ability to create sharded clusters . speaking on behalf of the entire redis community (my apologies if i have offended anyone by presuming :)), we expect redis version 3 to be a major new version in every respect!
besides the open source v3, there a few other redis clusters already out there. some folks went ahead and built their own clusters, each for her or his own reasons. i don't want to namedrop anyone (like twitter , flickr or pinterest ) but one company that has built a cluster is redis labs. our redis cloud service is powered by our own implementation of a redis cluster and it has been in use in production for the better part of the last two years. during that period, we've been building and operating our clusters across multiple clouds and data regions. as a startup company, we've had to build our systems to scale both well and economically in order to accommodate the spectacular success that our commercial public service is having.
redis labs is a contributor to the open source redis project - most of our staff are amazing developers that live and breath redis - but our users needed solutions that weren't ready within the open source's scope. in order to meet these business challenges, we've developed solutions that allow us to scale redis databases on the fly from megabytes to terabytes. we deploy, scale and manage clusters over four different iaas providers and across ~20 data centers. our users have created tens of thousands of databases, and for each database we've maintained not only availability and performance, but also taken care of the operational and administrative tasks (all with a tiny devops team ).
to use our redis cloud clusters, just sign up to our service and create a database. you can set up a sharded database in seconds (although sharding isn't included in our free tier). redis cloud instances can be sharded using the standard policy, i.e. per the open source redis cluster specification , or with a powerful custom sharding policy that's entirely configurable via a list of regular expression rules ( see the feature's help page and future updates for more information).
as long as i'm on the subject, here's one of the less-known facts about redis labs' clusters: you don't have to change anything in your application to start using them. yep, you can use your existing code and client library (whether cluster- and sharding-aware or not) and you'll still get all the scalability, availability and operational benefits that the cluster offers. our users need only create the database and configure its options (availability, data persistence, sharding, security and what not) and bazinga! they can just use the single redis url (hostname and port) that is the gateway to their database in a redis cluster. sure, there are tweaks, best practices, optimizations, tips, tricks and a gazillion other things you could do on top, but (as shown in the unbenchmark), our cluster is a quite a performer even without them.
i had meant to keep these notes brief, but clustering is a rich and favorite topic of mine and i could go on and on for days (actually i promise that i will - more related announcements/technical/benchmarks/specs/comparisons to follow). to keep this a medium-sized post, i'd like to end here and invite you to follow us and shout at me - i'm highly available :)
Published at DZone with permission of Itamar Haber, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.