Introduction to Redis
Redis is an open source, advanced key-value store and a serious solution for building high-performance, scalable web applications.
Redis has three main peculiarities that set it apart from much of its competition:
Redis holds its database entirely in memory, using the disk only for persistence.
Redis has a relatively rich set of data types when compared to many key-value data stores.
Redis can replicate data to any number of slaves.
Why Redis is different compared to other key-value stores?
Redis is a different evolution path in the key-value DBs where values can contain more complex data types, with atomic operations defined on those data types.
Redis is an in-memory but persistent on disk database, so it represents a different trade off where very high write and read speed is achieved with the limitation of data sets that can't be larger than memory. Another advantage of in memory databases is that the memory representation of complex data structures is much simpler to manipulate compared to the same data structure on disk, so Redis can do a lot, with little internal complexity.
Is using Redis together with an on-disk database a good idea?
Yes, a common design pattern involves taking very write-heavy small data in Redis (and data you need the Redis data structures to model your problem in an efficient way), and big blobs of data into an SQL or eventually consistent on-disk database.
What happens if Redis runs out of memory?
Redis will either be killed by the Linux kernel OOM killer, crash with an error, or will start to slow down. With modern operating systems malloc() returning NULL is not common, usually the server will start swapping, and Redis performance will degrade, so you'll probably notice there is something wrong.
The INFO command will report the amount of memory Redis is using so you can write scripts that monitor your Redis servers checking for critical conditions.
Redis has built-in protections allowing the user to set a max limit to memory usage, using the
maxmemory option in the config file to put a limit to the memory Redis can use. If this limit is reached Redis will start to reply with an error to write commands (but will continue to accept read-only commands), or you can configure it to evict keys when the max memory limit is reached in the case you are using Redis for caching.
Exceptionally Fast : Redis is very fast .
Supports Rich data types : Redis natively supports most of the datatypes that most developers already know like list, set, sorted set, hashes. This makes it very easy to solve a variety of problems.
Operations are atomic : All the Redis operations are atomic, which ensures that if two clients concurrently access Redis server will get the updated value.
MultiUtility Tool : Redis is a multi utility tool and can be used in a number of usecases like caching, messaging-queues (Redis natively supports Publish/ Subscribe ), any short lived data in your application like web application sessions, web page hit counts, chat etc.
Related Results :
- Related Posts are generally User Blog posts.
- or Other tutorials from other networks of w3clan.com.
- Any registered user can create related posts based on search term tags.