Redis is a widely used open-source in-memory data store and cache that has become a key component in the development of scalable microservice systems. While all of the main cloud providers provide fully managed Redis services (Amazon ElastiCache, Azure Cache for Redis, and GCP Memorystore), it may also be simply implemented in Kubernetes if you require additional control over the Redis configurations.
This session leads you through setting up a Redis cluster on Kubernetes with data persistence, what’s the best way of establishing a “prod”-ready Redis cluster that considers storage and persistence even after a restart. With the help of monitoring and hardware optimizations for your cluster, you’ll learn about measuring your performance and best practices for Redis on Kubernetes. In the end, we discuss whether operators or Helm charts are a more mature option for your Redis on Kubernetes, and a few tips as a production checklist.
Hrittik Roy 00:00
Hey everyone, I hope you’re having a great day today here at DoK Day, I will try a community advocate at Portainer.io, and with me is Ryan Gray, our technical consultant here at Portainer, you know, join us on this exciting event titled resilient Redis where we are going to talk about why Redis is used, where is it used data on Kubernetes and why they document is important. How can you deploy Redis on Kubernetes and by the end of the talk, we will help you with a checklist to deploy Redis on production on Kubernetes. Why Redis This is one of the most important questions we are asked. So Redis which stands for remote directory server is a fast open source in-memory key-value data store and is used as a database cache, Message Broker and cue the popular use cases of Redis in production of caching, queues, Pub Sub systems giving you the votes, session stores, rich media streaming and a lot more. It’s highly available and scalable. Ready suppose either a single node primary or a cluster primary replica architecture. This enables you to create highly available solutions with predictable performance and dependability. When you need to change the size of your cluster. It’s as easy as to go and scale in or scale out. This allows your cluster to scale and meet your needs. replication and persistence another advantage of Redis uses a primary replica architecture that allows for a synchronous replication of data across multiple replica servers. This improves read performance. Since queries are distributed among the servers and allow for faster recovery when the primary server goes down. Redis also gets point-in-time backups for persistence by using this. Another key benefit of Redis is its performance. Redis is synchronous with performance and all data is stored in memory, allowing for faster data access with low latency. In memory data storage and actuation, database do not require trip to disk to creasing engine latency to microseconds. As a result in-memory data source can handle orders of magnitude more operations and provide significantly faster response times. As a result, read and write operations take less than a millisecond on average, and millions of operations per second are supported. This is one of the advantages while it is used across GitHub and all lot more organizations to use it to store and manipulate blocks. The another disadvantage, advantage of Redis is like it’s flexible data structures. Ready suppose a lot of data structures to meet all your needs. And the last and most important advantage is simplicity and ease to use. Redis is one of the most popular open-source databases. It has a lot of open-source clients for most of the programming languages. Redis is fairly simple to setup if you’re setting before production or just test purposes to simplicity makes it so popular. Wide data on Kubernetes Why should you store data on Kubernetes? The question is why not Kubernetes was distributed orchestrator was originally designed to run stateless workloads. But today it is increasing in popularity to run databases or others stateful workloads. Various enterprises utilize it on Kubernetes. And communities like to key and empowering users as well as organizations to do the same. How to deploy Redis so you can identify Redis using Redis operator, or you can use Helm charts. Helm charts is one of the most popular options. What is 14 a patina is its UI for your Docker, Kubernetes, swarms, and IoT. Today, Ryan will help us with the deployment of Redis why victims Redis and charts
Ryan Gray 04:37
Portainer makes deploying Redis via Helm chart, very simple. The first thing I want to do is create a namespace for Redis to live in. So I’m going to click on Add namespace. I’m going to call this Redis. And for the sake of this demonstration, I’m going to turn off resource assignment, and I’m going to go ahead and click on Create namespace. And now that we have our new Redis namespace I’m going to click on helm over on the left, and I’m going to search for Redis. In our list of Helm charts, I want to deploy the Redis cluster Helm chart. I’m going to select the Redis namespace that we just created. And I’m going to call this application Redis. And then I am going to look at the custom values for this Helm chart. Because before I install it, I want to set a specific node port to use for my installation. That’ll be port 32,000. And now I can click on install. And as soon as the Helm chart is done, installing will get a notification that it’s been installed successfully. And now we just wait for our replicas to come up. And by clicking on this name right here, we can get more details about our deployment. And we can see now that all six of our replicas are running and Redis is ready for use. A few other considerations that we’d like to point out are Redis is persistent strategy, disabling transparent huge pages, and benchmarking. Redis itself provides several persistence options, there are four persistence strategies in Redis. The first is our dB, the Redis Database, which performs snapshots of your entire data set at specified time intervals. The second ALSF append-only file logs every write operation that the server receives. So when the server starts up, the log is replayed and it rebuilds the entire data set. Another strategy is no persistence at all, in which case your Redis data will exist for as long as the server’s running, and then it will cease to exist when the Redis server stops running. And lastly, the combination of using the Redis Database and the append only file it will using this strategy Redis will behave in an append-only file manner. But along the way, it will also be taking point-in-time snapshots. Disabling transparent huge pages after deploying Redis you are likely to see the following warning. And you can follow the fix in this warning and make sure that it is configured to happen at the next boot of your server. And this can be automated using init containers. And finally, some benchmarking resources.
Hrittik Roy 07:33
Thank you for attending our talk. And if you have any questions, feel free to tag us on Twitter.