CGI performance: using mod_cache
David Bovill
david at openpartnership.net
Sat May 31 07:29:18 EDT 2008
I'd like to speed up performance of a Rev based CGI by caching the results
on the server - however I want to retain the CGI based dynamic behaviour.
>From reading around it looks like this is possible, and I think this could
be a generally useful hack for Rev based CGI's. AFAIK this is a fairly
standard issue largely solved by other frameworks.
Here is the scenario:
1. You have a dynamic cgi that fetches data from a database, munges these
up and serves up your page
2. The CGI is painfully slow
3. It is not possible to optimise the cgi
4. You decide to use caching
5. But when you update the database you want to the new data to be served
- you want to retain the dynamic behavior
6. Users need to be able to update the database - so you cant do this
with your own code - you need an automatic solution.
I am not sure how to achieve this - but there seem to be the server based
functionality needed with any new Apache installation. Here are some
"ideas":
- The Rev CGI could set HTTP headers depending on if the data in the
database had changed (not sure this will work)
- The Rev CGI used to update the data (model)
- also changes the .htaccess directive
- somehow updates the cache
- Give up using Apache Cache and simply write the data out to a file -
creating and maintaining your own cache
What you want is a robust file based "data_changed" flag - which instructs
Apache to go fetch new data from the cgi.
It seems that by using simply and carefully the built in Apache Cache
ability - you should be able to use Revs flexible nature to create complex
CGI's and not worry too much about optimising them or having to write extra
code to store and maintain you own files. Any ideas?
More information about the use-livecode
mailing list