File Cache and memcache memory cache. which one should I select?

Source: Internet
Author: User
File Cache and memcache memory cache. which one should I choose? As the company needs it, I need to count the Click status of each user on the webpage and enter those links. The company's website traffic is approximately more than 1 million ip800wpv. Memcache was initially used to cache users' clicks. when the number of clicks reaches a certain number, it is written to the database. But due to the concurrency, the file cache and memcache memory cache should be selected?
As the company needs it, I need to count the Click status of each user on the webpage and enter those links. The company's website traffic is about more than 1 million ip address, 800 pv.

Memcache was initially used to cache users' clicks. when the number of clicks reaches a certain number, it is written to the database. However, due to concurrency, multiple php processes write data to the database at the same time, and a lot of data is duplicated.

My colleagues and I have two solutions. The first one is to create multiple arrays in memcache to store cached data. a single array cannot exceed 1 MB. Then, a separate php process is used to plan the task, and the arrays in memcache are regularly used to execute the database.

Second, I used the file cache. when the maximum number of clicks in memcache is reached, I saved the data to the file and cleared the memcache. Then, an independent process is used to perform the import operations.

Which one should we choose?

------ Solution --------------------
Why use file caching to store data?
When the maximum number of clicks in memcache is reached, the data is stored in the database and the memcache is cleared.
------ Solution --------------------
When memcache reaches the upper limit, do not rush into the database. you should recreate a memcache cache.

It can be understood as follows:

There are two memcache caches, one working and the other waiting. The current job has reached a certain limit, so we can pull it down and go to the other one.

A typical shift change ..

I wonder if this will solve your 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.