Scalable, clusterizable and faster Cache with Redis
Alvaro Pa?ó
Software Architect & Tech Leader | Crafting High-Performance, Cloud-Native Systems | 10+ Years in Full-Stack Development | IDCiber Consul Member
Helo everybody!
Today I came to share some of my knowledge about web / mobile API caching using the popular Redis database.
But what is Redis? Redis is a software for storing and sharing data in memory, used as a database. In practice, Redis is nothing more than a key/struct database (that's right! not just a key/string database). It basically stores values ?for a specific key in memory.
Redis is designed to be extremely fast and performance-efficient. And this was achieved by using in-memory storage instead of physical disk storage. Redis uses memory to store its tuples rather than write and read to disk, which brings impressive performance gain compared to conventional and other non-sequential databases.
In addition to the advantage of using memory to store your data, its developers have created many functions, more than 160, specifically for performance gain. Besides extremely fast, Redis is single-thead, which increases its speed and eliminates locking of tables.
The main use of Redis is as a Cache server, parallel to the conventional DBMS, acting on data persistence. It is impressive how much data it can store and search in memory and is widely used by large online services.
In addition, Redis works with distributed data systems. You must be thinking: but how does it persist the data if the server falls, if it stores in memory? You're right! But Redis engineers thought of this scenario. It turns out that Redis can store backups to disk if there is a problem. It can also create backups on other Distributed Redis instances, so you can have multiple mirrors from your cache server.
Another very exploited feature of Redis is the pub/sub system. The pub/sub system allows you to create communication channels, which allow users to connect and receive the same updates in real time. With this we can, for example, develop systems of chats, push-notifications and games in real time.
Redis is now well-known in the community because, in addition to all the qualities it is open-source, which guarantees long life to this project. This is why many companies use and are behind it like: Pinterest, Twitter, eBay, CraigList, Digg, Flickr and many others.
To learn Redis in the practice, i suggest to do a tutorial at https://try.redis.io/.
Bye =)