Question about Caching

djalam

Member
Messages
89
Reaction score
2
Points
8
http://bit.ly/fjMoS Read that, about caching files. Is it a good idea? or is it a system resourse hog. If you are making like a list of 10 things with description. Nothing too big.
 

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
I can't read the article at the moment (chrome keeps trying to translate everything into german), but I know that caching uses a lot of resources (a lot of free hosting suspensions are from caching scripts)

~Callum
 
D

dWhite

Guest
Last edited by a moderator:

djalam

Member
Messages
89
Reaction score
2
Points
8
Gotcha, thanx for the heads up.Won't be doing that now. I only looked into it to see if it helps limit the strain on the database query. Thanx. And yeah lol didn't want to alarm anyone with short url my bad.
 

bhupendra2895

New Member
Messages
554
Reaction score
20
Points
0
Well, I am using caching on my phpbb site and it is not suspended till now.May be because it has only four posts and four members. :D

Well seriously if I deploy any web application(Specifically Joomla, WordPress or Zend framework project) that uses file based caching can it be a resource hogger?Caching saves us resources then how it can be a resource hogger?

I have seen high resource usage suspension of many WordPress users because of the plugins they use.
 

Anna

I am just me
Staff member
Messages
11,756
Reaction score
583
Points
113
During the process of building the cache it uses up a lot resources (CPU mainly, but also ram), depending on how much content has to be added in the same run, and I'd assume a bit on how the caching is actually done.

Once the content is added to cache, the resources they save is mainly bandwidth, and it may speed up the page load for the end viewer a little, often not really noticable.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
It's not so much that caching requires more resources as it trades space for another resource, such as (processor) time or bandwidth.

In storing and reusing the results of (expensive) computations, additional space is used but time can be saved; PHP accelerators are an example of this, as is memoization. As the gaps between processor and memory performance and processor and I/O performance increase (processors have been outstripping the other two), space becomes more and more valuable. Consequently, computational tasks must be correspondingly more expensive to make caching them worthwhile. Due to PHP's architecture (at the end of a script's execution, all data is discarded), cached data can't be stored in memory, so some form of persistent storage must be used instead. Disk storage speed is extremely slow relative to processor speed, so that option usually isn't worth it, but relegating storage to a DB (which can be forced to store the data in memory) may be viable.

As for network caching, the factors affecting its utility are network latency (~ 10-100ms) and goodput (~ 128kB/s-1GB/s for high speed, though not many connections will run at the upper end of that range), disk access time (~ 6-26ms) and throughput (~ 50-400 MB/s), available storage space (currently unmetered, so I'm not certain what the limits are) and the hit rate. From the first four statistics, we can expect that fetching data from disk is (very) roughly 10-20 times as fast as from the network (which puts an upper limit on how much caching will improve performance), with latency being comparable. The statistical ranges given reflect the variance between hosts; on a given host, the statistics will be more consistent. Hit rate will vary wildly, depending on storage space and the exact order that items are requested. Hit rate will scale the upper limit on performance increase; with a hit rate of (e.g.) 50%, we should expect at most a 5-to-10-fold performance increase from network caching. If you're fetching small amounts of data (on the order of 10**5 B, roughly), service time won't be much improved by caching; if it takes more than a few seconds for the server to fetch data per request, caching should give a noticeable improvement in performance.

Network caching is a subset of caching data from I/O bound processes. Caching search results is another, which can be advantageous if there is a large amount of data that must be examined for each search.

Your best bet is to design your site without caching, but make it easy to add it later on, if necessary. It's best to optimize later in the development process, once you've got a solid design and a working system.
 
Last edited:

callumacrae

not alex mac
Community Support
Messages
5,257
Reaction score
97
Points
48
Well, I am using caching on my phpbb site and it is not suspended till now.May be because it has only four posts and four members. :D

phpBB only caches the style, so that it doesn't have to be parsed every time, therefore using less resources. It also caches config.

~Callum
 
Last edited:
Top