Bump redis Application Experience

Source: Internet
Author: User
ArticleDirectory
    • 1. Use redis as a message queue
    • 2. Use redis as the log collector
    • 3. Store social relationships
    • 4. Used as the cache Layer
    • 5. About persistence
    • 6. Problems with using MongoDB

Here, bump is the app that can exchange information when a mobile phone is touched. This article is fromBumpDeveloper blog, they described their own useRedisMethods, as well as some experience in the use process, includingMongoDBFor some problems with the same machine deployment, the nosqlfan translation is as follows:

1. Use redis as a message queue

The List Data Structure of redis is used, and nosqlfan has discussed the method of using sorted sets structure for Message Queues with weight.

2. Use redis as the log collector

In fact, it is still a queue. Multiple endpoints write log information to redis, and a worker writes all logs to the disk in a unified manner.

3. Store social relationships

For example, if you want to store everyone's friends in a set, you may only need to use the intersection command to obtain the mutual friends of two people.

4. Used as the cache Layer

The cache used for persistent storage, like memcached, can cache data in redis after the persistent storage is obtained successfully. We know that redis has better performance than memcached.

5. About persistence

For persistent storage, you can choose to regularly flush into RDB or enable aof logs. The specific method depends on the degree of data reliability that can be accepted by the business.

6. Problems with using MongoDB

One reminder is that redis and MongoDB were put on the same machine in the early stage of bump, and because of the single thread of redis, mongoDB often takes too long to execute a process (such as malloc or write AOF) due to the CPU or disk I/O usage, which further causes all operations to be blocked and delayed, therefore, try not to use it in scenarios where the CPU or disk I/O may be heavily occupied and the redis working thread is blocked.

Source: devblog. Bu. MP

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.