Cache solution for keyword aggregation page

Source: Internet
Author: User
A keyword aggregation page (http://www.chinabyte.com/list/A/) has about 30 thousand keywords, including two pages: one is the keyword list page, the other is the keyword search result page, this is because the crawling frequency of the page search engine is high and the server is often overwhelmed. these keyword data, including the search result pages, are all cached by memcache for one week. A keyword aggregation page (http://www.chinabyte.com/list/A/) has about 30 thousand keywords, including two pages: one is the keyword list page, the other is the keyword search result page, this is because the crawling frequency of the page search engine is high and the server is often overwhelmed. these keyword data, including the search result pages, are all cached by memcache for one week.

The reason for exceptions on the server is suspected to be that the expiration time of the keyword data cache is relatively concentrated. as a result, when crawlers crawl data, the database is frequently read for a short period of time.

There are two solutions to solve the problem of server exceptions caused by cache invalidation time set:

1. set the random cache time
$ Rand_minute = mt_rand (30, 60); $ rand_hour = mt_rand (1, 24); $ rand_day = mt_rand (3, 7 ); $ lifetime = 60 * $ rand_minute * $ rand_hour * $ rand_day;

In this way, after a period of time, you can average the cache time to avoid being too concentrated.

2. Solution 1 + file cache

This is the solution. I think it is a bit unreliable to set this random cache time. I wonder if there are any other good optimization solutions?

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.