How do I deal with the amount of clicks that Redis implements

Source: Internet
Author: User
Redis achieves click-through volume
Business description
CMS article Views (title is loaded), click Statistics (the amount of the article is clicked Open)
The following is the statistical business I designed, the main technology Redis,nodejs,redis application of the click Cache to reduce database pressure, nodejs through asynchronous non-blocking mechanism to realize CMS business logic and statistical function differentiation
Incoming parameter Cateid (category ID), ArticleID (article ID), SOURCEIP (Request source IP)
First, the storage policy
1, according to the time granularity of records
Redis is stored as hash
HASH
KEY VALUE
Time his
0 0
1 10
cateid_arvicleid_t. .
. .
. .
23 230
2, by Source statistics
Redis is also stored in hash, and the source is divided into provinces


HASH
KEY VALUE
Provinc his
Hebei 0
Henan 10
Cateid_arvicleid_p. .
. .
. .
Shandong 230
Second, the data synchronization mechanism
Now only the time to synchronize Redis data to the database with Linux scheduled tasks
Third, cache data expiration mechanism
Scenario one through Redis auto-expiration Time
This scenario needs to be performed later in the data synchronization mechanism, to ensure that the data is in storage, to clean out the expired cache, and now consider that synchronization is performed 0 o'clock daily, then the Redis cache needs to be set up for more than 24 hours
Program two through the database synchronization mechanism at the same time to clear
This scenario is the synchronization and cleanup cache together, discarding the redis expiration mechanism


I hope you have the great God to point out the inappropriate and optimization of the place
In 10000 online users, 1000 concurrent based on the storage mechanism of the above redis is feasible for memory pressure
Whether the synchronization mechanism and the cache expiration mechanism have a better solution
In this humbly
------to solve the idea----------------------
The KEY is best set to 2014_10_30. cateid_arvicleid_t form

Option two the synchronization mechanism of the database is simultaneously cleared at the wee points of the morning at the same time because of script 1. Synchronization scripts may fail 2. When the data is large, yesterday's 0 o'clock data will be covered by 0 o'clock today.

A redis that claims 1 seconds of 10W is not afraid of the concurrency of 1000

  • 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.