Why use Redis project

Why use Redis

 

redis is Nosql database, is a key-value storage system. While redis is a key-value storage systems, but redis support the value is very much the type of storage, such as strings, lists, sets, and hash ordered set.

redis is a key-value storage system . And Memcached Similarly, it supports relatively more stored value type, comprising a string (string), List ( list ), SET (set), zset (sorted set - ordered set) and hash (hash type). These data types are supported push / pop, add / remove and on the intersection and union, and difference richer operation, and these operations are atomic. On this basis, redis support a variety of different ways of sorting. Like with memcached, in order to ensure efficiency, the data is cached in memory. Redis difference is periodically updated in the data written to disk or to modify the operation of writing additional log file, and on this basis realize the master-slave (master and slave) synchronization.

Redis is a key-value high-performance database. redis appears, to a large extent compensated for memcached lack of such key / value store, it can play a very good complement to relational database in some situations. It provides Java, C / C ++, C #, PHP, JavaScript, Perl, Object-C, Python, Ruby, Erlang and other clients, very easy to use. [1] 

Redis supports master-slave synchronization. Data can be synchronized from the primary server to an arbitrary number from the server, the server may be associated with the primary server from another server. This allows the tree Redis single executable copy. Intentionally or unintentionally, can save the data write operation. Since the full implementation of the publish / subscribe mechanism, so that the database synchronization from a tree anywhere, can subscribe to a channel and receive the full message master server publishing record. Synchronization scalability and redundancy data useful for a read operation.

Redis is completely free open source, BSD comply with the agreement, it is a high-performance key-value database.

Redis supports five data types: string (string), hash (hash), list (list), set (collection) and zset (sorted set: an ordered set).

 

Redis and other key - value caching product has the following three characteristics:

  • Redis supports data persistence, data in memory can be saved to disk, reboot to load when you can be reused.

  • Redis only supports simple key-value data types, while also providing a storage list, set, zset, hash and other data structures.

  • Redis supports backup data, i.e., data backup master-slave mode.


Redis advantage

  • High performance - Redis can read as fast as 110,000 times / s, write speed is 81000 times / s.

  • Rich data types - Redis supports binary case Strings, Lists, Hashes, Sets and Ordered Sets the data type of the operation.

  • Atomic - Redis All operations are atomic, meaning that either succeed or fail completely executed execution. It is a single atomic operation. A plurality of operation also supports transaction, i.e. atomicity, and EXEC instructions by MULTI wrap.

  • Feature-rich - Redis also supports publish / subscribe, notification, key expiration and so on characteristics.


Redis and other key-value store What is the difference?

  • Redis has a more complex data structure and provide atomic operations on them, which is different from the other databases evolutionary path. Meanwhile Redis data types are based on the basic data structure transparent to the programmer, without the need for additional abstraction.

  • Redis running in memory, but can be persisted to disk, so that when the high-speed read and write memory tradeoffs different data sets because the data can not be greater than the amount of hardware memory. Another advantage of in-memory databases are, compared to the same complex data structures, operate in a very simple memory on the disk, so you can do a lot of internal Redis highly complex matter. Meanwhile, in terms of their compact disk format to generate additional way, because they do not require random access.

 

So why use such a database similar redis Nosql it?

1) When the total size of the data amount of a machine fit;

2) a data index when the machine's memory fit;

3) the amount of access (read mixing) an instance when fit.

 

Single age, with only one storage machine is installed mysql, if thousands of each data storage, so that it will result in poor performance of mysql, storage and reading is very slow, and then turned into a vertical split cache + mysql + points the way.

 

Cache as Cache middle age, all the data is first stored in the cache, and then stored in mysql, reducing database stress and improve efficiency.

But when data is added to another order of magnitude again, the above manner can not meet the demand due to increased pressure on the database write, read cache can only ease the pressure on the database. Focus on reading and writing in a database so that the database overwhelmed, most sites start using master-slave replication technology to achieve separate read and write, in order to improve read and write performance and scalability reading library. Mysql the master-slave mode this time become a standard website.

 

Separated from the main mode of the times, in redis cache, MySQL master-slave replication basis, separate read and write above, then write the master pressure MySQL database bottlenecks began to appear, and the amount of data continues to surge, due to the use MyISAM table lock, the lock would be a serious problem in a highly concurrent, a large number of highly concurrent applications to start using MySQL InnoDB engine instead of MyISAM.

 

Advantages Nosql database

1) easy to expand

These types of data storage does not require a fixed pattern, without any extra operation can be extended laterally. With respect to the relational database can be reduced particularly in the case of tables and fields. No type between the ability to bring scalable architecture on the level

2) large amount of data to improve performance

3) diverse and flexible data model

Guess you like

Origin blog.csdn.net/fenlin88l/article/details/89446064