c# - Recaching page and web service under high load -


i have web shop 2 layers of cache. 1 web service , 1 in web project. problem when want recache, because of price changes or adding new products, site crashes , request limit reached.

in web service, have taken out cache entries httpruntimecache , rerun methods in it. (i have triple checked successful.)

while run still keep original cache , new ones become _temp_cachekey , when complete overwrite old data so:

foreach (string key in cache) {     var value = httpruntime.cache[key];     if (value != null)     {         httpruntime.cache.insert(             key.replace("_temp_", ""), value, null,             system.web.caching.cache.noabsoluteexpiration,             system.web.caching.cache.noslidingexpiration,             system.web.caching.cacheitempriority.notremovable, null         );     } } 

after kill cachekeys on site this:

list<string> toremove = new list<string>(); foreach (system.collections.dictionaryentry cacheitem in httpruntime.cache) {     toremove.add(cacheitem.key.tostring()); } foreach (string key in toremove) {     if (!key.contains("mypagesindex"))     {         httpruntime.cache.remove(key);     } } 

does have idea of how can overcome issue? missing something? there better way rebuild runtime cache?

note: if site have visitors<100 works fine , if above, server cpu still @ maximum 10-20%


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -