(keitai-l) Page caching

From: Mika Tuupola <tuupola_at_appelsiini.net>
Date: 12/20/00
Message-ID: <Pine.GSO.4.05.10012201352100.27369-100000@aurinko.taivas.com>
	I'm answering to Nick's old mail which can be found at:

	http://www.appelsiini.net/keitai-l/archives/2000-12/0078.html

On Fri, 8 Dec 2000, Nick May wrote:

> Does anyone know of any papers that go into these issues in detail? 
> Can anyone suggest any Apache/Mysql tweaks specifically to improve the
> efficiency of serving such smallpage/lotsa-hits sites?

	I'm just implementing locally cached dynamic pages to
	one PHP + MySQL driven dynamic website and it occurred
	me this could be the answer to your question too (after
	all i-mode pages are just small webpages).

	The keyword in here is _locally cached_. I don't mean
	external proxys but the application itself caching
	the dynamic pages.  Lets assume there is a page which 
	generates a couple of lenghty SQL queries to database.
	On application level (serverside) it works something
	like this (really simple version):

	1) Client requests the page.
	2) The server makes the SQL query and generates the
           resulting cHTML page and does two things with it:
              * sends the result to the client
              * writes the generated cHTML code to a static
                local file in the servers filesystem
	3) Another client requests the same page
        4) Server knows it allready has the page in cache
           and sends the static local cHTML file as the result
           without doing any SQL queries or parsing.

	This does not save any bandwith and it is not the point.
	The point is to reduce database and www server workload.

	You should consider things like how long the cache has
	time to live. If the site is updated constantly the
	TTL should probably be something like 30 seconds to
	to 5 minutes. If the site is update less often TTL
	can be longer too.

	Lets assume the TTL is 5 minutes. One page generates
	2 database queries. This page gets one hit every
	second. This totals 600 SQL queries in the 5 minutes.
	If the page uses local caching with 5 minute TTL it
	will only generate 2 SQL queries every 5 minutes.

-- 
Mika Tuupola                      http://www.appelsiini.net/~tuupola/


[ Did you check the archives?   http://www.appelsiini.net/keitai-l/ ]
Received on Wed Dec 20 14:17:18 2000