📜 ⬆️ ⬇️

Redis - High-Performance Data Warehouse

Cheerful day, habrocheloveki!

What is Redis?


Redis is a high-performance, non-relational distributed data warehouse. Unlike Memcached, which can delete your data at any time, displacing old records with new ones, Redis keeps the information permanently, so it looks like MemcacheDB .

How is Redis different from existing solutions?


The Memcached API (MemcacheDB) allows you to store arrays, but these arrays will be serialized and stored as strings, so atomic operations on such arrays are not possible.
Redis allows storing both strings and arrays, to which you can apply atomic pop / push operations, make selections from such arrays, sort elements, get associations and intersections of arrays.
')

Performance


110,000 SET requests per second, 81,000 GET requests per second on an entry-level Linux server ( tests ).

The high speed of the Redis operation is ensured by the fact that the data is stored in the RAM and is stored on the disk either at regular intervals, or when a certain number of not saved queries are exceeded. From this it follows that using Redis, you can lose the results of the last few queries, which is quite acceptable for most web applications, considering that the speed of accessing Redis is comparable to that of RAM. However, losses can be avoided through redundancy - Redis supports non-blocking master-slave replication.

Sharding


Redis, like Memcached, can work as distributed storage on many physical servers. Such functionality is implemented in client libraries, and unfortunately, out of the box, this functionality is implemented only in the Ruby API, but this does not prevent you from hashing the key yourself and getting the server ID to which you can access this key.

API


The API is available for the following languages:


The PHP API is available both as a module written in C and as a PHP5 class that communicates with the Redis server through sockets, so you do not need to install the module.
In addition, there is a PHP5 class from a domestic developer (with a trustworthy name . I'm serious .) - IMemcacheClient . (Thanks to DYPA for the vodka)

Development prospects


The development is very active, the commits occur almost every day, the Redis 0.900 version (1.0 release candidate 1) is now available, which will soon become version 1.0
In the near future, the authors promise to introduce various interesting features, including data compression.

License and Supported Platforms


Redis is written in ANSI C and works on most POSIX systems (Linux, MacOS X). This is free open source BSD licensed software =)

Up: Rediska is a convenient PHP client for the key-value of the Redis database . Of.sayt .

Source: https://habr.com/ru/post/64917/


All Articles