Redis+mongodb best Practices for read-write separation-excerpt from the network

Source: Internet
Author: User

Scenario 1. (be denied)

Plus Redis, MongoDB read and write separation, a single process from MongoDB in time to synchronize tasks to Redis.

It looks perfect, but there are all sorts of questions coming up on the line, listing:

How much is the 1.Redis queue length appropriate?

2. How many tasks are appropriate for the synchronization process from MongoDB to Redis based on priority? Too big to cause a lot of unnecessary overhead, too small to operate MongoDB frequently

3. When a sub-task is processed slowly, it causes MongoDB to have a higher priority task without ending, and the lower priority does not get processed, causing the consumer to idle

Final Solution:

While the producer is generating a task, to the Redis synchronization task, the Redis sort set (ordered set, guaranteed priority order), the consumer through the RPC call, the RPC server removes the task from Redis and then ends the task and deletes it from MongoDB.

Test results, Redis insertion efficiency. Redis-benchmark concurrent 150,32byte A task, total 100W, insertion efficiency 7.3W (no persistence used)

Before that, our worries were not necessary, and Redis had a very good performance.

At present, this system can be competent for 5KW of daily tasks, I believe can be more.

Redis+mongodb best Practices for read-write separation-excerpt from the network

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.