Record a problem

Source: Internet
Author: User

My background service has two parts:
1. Interface data, data from the start of the project to check the library, the data into the cache, and then to subscribe to another group broadcast MQ messages to constantly flush the cache. At the same time to check the library regularly, to prevent MQ hanging off, to ensure that the data is correct.
2. Push the data, this is another project, but the thing to do is simple, forward the message that is subscribed from another group, we wrap it ourselves, and then send it out.

Front-end invocation:
The client first invokes the interface data to complete the model initialization, and then establishes the WebSocket to accept my push message.

Problem:
When the client receives a push message at some point, updates the interface's data, and then manually refreshes the interface and requests the interface data, the data is found to be old. According to my logic above, there should be no old data.

Problem Lookup:
After investigation, the group of Friends will update the data of the database before sending the message to us, that is to say, the data of their database must be new.

Problem Lookup continues:
But then I found out that although their update--------the message has a logical succession, but does not guarantee that after the message is sent, the database data will be updated immediately. This causes the problem to occur when we accept that the MQ message updated the cache, and just ran into my timed vault overwrite cache, when the data from the library is likely to be older than the data in the cache.

Solution:

I can only make some fault-tolerant concessions in situations where you can't change the logic of your group of friends. After Chaku, I made a comparison between the data in the database and the data in the cache before updating the cache, and if the data for the database were updated, the cache was refreshed and the cache was not flushed and all operations were ended.

Record a problem

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.