Redis Cache Server Notes
Redis is a high-performance key-value storage system that can serve as a caching framework and queue
But since he is a memory memory system, the data is stored in the database
As a caching framework:
create/updae/delete-at the same time to Redis and database
query– first from the Redis, no records to check from the database, and the results from the database also put a copy to Redis
As a cache queue:
2, the object is stored in the Redis, how to save. Memcache Access objects are serialized and deserialized
Use common serialization, deserialization (frequently consuming CPU, using Google Protocol Buffer to make objects into two
Feed stream)
or use JSON storage (Alibaba's Fast-json)
3, Java Use Redis client is generally: Jedis
Jedis native interfaces support only basic data types and string, byte[]
4, my understanding of the Redis queue:
Important data: First save to database, then save to Redis
Requires high response data: Write cache first, then write to the database via Message Queuing
Because the value of Redis supports string, list, set, Zset
Then you can use the Redis list as a queue.
Team: Lpush mylist ' Hello1 '
Out team: Lpop mylist
5, it provides AOF (Append operation record file) and dump (regular data backup) Two kinds of persistent way
6, VM (virtual memory mechanism): if there are 10,000 data saved in memory, then I will configure to store so much data memory
Then these 10,000 data have 9,000 not active data, that is wasted, you can do so, when the data capacity exceeds memory,
Store part value in a file
The memcached is to store the data completely in memory, while Redis is the majority, because he supports the custom VM
At the same time Redis support master-slave copying mechanism
Reproduced from: http://doushini.iteye.com/blog/1879616