Welcome Guest, Not a member yet? Register   Sign In
Caching every 1 second
#4

[eluser]richthegeek[/eluser]
Actually yes, with regards to your caching.

Caching is only worth it at a large number of hits, cos of maths...

uncached = time to execute * number of hits
cached = (time to execute * time to write to file) + (time to read cache * number of hits)
time to execute = SQL exec time + PHP exec time

In the uncached one if your SQL exec time is low compared to the overall exec time, then it's worth caching the output.
In the cached one, you will be dealing with the relative slowness of your disk - it can take half a second to write a file on a filesystem under strain, and about 1/100th to read, especially repeatedly due to the file being memcached.

Basically, doing it every second means you are spending more time arranging the cache than you are saving from caching.

You can do your cron job every second to automatically end auctions, and stop users from placing bids on auctions that have just ended, but the actual output can be cached every 30 sections, minute, whatever.

All the same, you'd probably get more benefit out of using memcached (stores the compiled PHP for execution, cutting per-page load times) or other exec-time reducing technologies.


Messages In This Thread
Caching every 1 second - by El Forum - 01-16-2010, 03:12 PM
Caching every 1 second - by El Forum - 01-16-2010, 04:56 PM
Caching every 1 second - by El Forum - 01-16-2010, 05:21 PM
Caching every 1 second - by El Forum - 01-16-2010, 05:39 PM
Caching every 1 second - by El Forum - 01-16-2010, 06:03 PM
Caching every 1 second - by El Forum - 01-16-2010, 07:55 PM
Caching every 1 second - by El Forum - 01-17-2010, 08:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB