Redis Key-Value Storage System--basic knowledge points

Source: Internet
Author: User
Tags message queue redis redis desktop manager redis server

Redis Remote Dictionary Service--nosql Technology

One or five kinds of basic data types

String list Hash set sorted set (sorted collection)

Two or five kinds of features

(1) InMemory in memory similar to cache, is a key-value storage system

(2) Weakening the transaction is basically not the concept of a transaction, only in some places the transaction is traversed, and its traversal is not encountered errors to stop, but encountered errors regardless of handling.

(3) Cluster environment

(4) Key-value query

(5) Scripting language support

Three

Redis is a single-threaded system,

Support for persistence (cache does not support persistence)

Subscribe/Publish function

Redis Message Queuing features

A B C

If the A,B,C server subscribes to a key of the redis, it can be posted to the Redis message queue via a in this key, and Redis will push the message to all B,C servers that subscribe to the key. The Redis itself does not store this data.

Iv. the difference between Redis and memcache

Memcache cannot be clustered, Max 1M

Redis can be clustered for a maximum of 1G

Five, redis commonly used between the Web server and database, as a caching system, because it has a persistent function, you can connect to the database, a large number of data in the Redis cache, Web server or application and Redis cache interaction, can improve the performance of program execution.

Web server--redis Server--database

VI. Redis has a third party graphical interface Redis Desktop Manager. But it's not particularly useful.

Seven, REDIS data structure of various commands

Http://redisdoc.com/redis Command Reference

String type

List type

Lpush rpush lpop rpop irange Blpop blocked version

Eight, session management

IX. Cluster Services

1, solve a single node failure

2, read and write separation

Redis Share

Web server--redis Mater

Redis Share

X. REDIS acts as Message Queue

Message Queuing implements subscription/publishing capabilities

Xi. Redis acts as a database server

12, Redis currently need to solve the problem is the memory problem.

The memory is limited, the game data is huge, how to write the data in the Redis memory to the database, or read out the data from the database.

1. Serialize to Local

2, Redis whether to support data write to memory

3, cluster expansion, but this can only solve the capacity of the problem, can not solve the game a large number of dead data problems

Solve memory problem: The main thing is to start from the point of view of the active user from the game dead data.

Methods: When the uniform time to clear the dead data, to determine whether the player Playerbean data more than a certain time, more than set the player Playcache in the state identity is illegal. In Playercache data from a large number of load players in the database into memory, the status is illegal and the data empty is removed.


4, the framework to solve

Redis Elimination expiration mechanism:

Each random 10 keys, idle time non-stop execution. Memory is tight when all traverse, delete the expired key to free memory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.