one solution (of which there are _many_) is to change the way in which your Perl script returns data.
One method that I implemented once was to use a combination of Apache mod_rewrite, apache .htaccess files and of course Perl.
I installed the mod_rewrite module into Apache. Created an .htaccess file that basically did the following:
- if user is looking for a file or is requesting a url that has been previously asked for, check in the /cache for a file (or a file that represents the data matching the url). If the file exists then redirect the users browser to that page (or premade cached file) -> the end result is the user never hits the cgi (perl script)
- if the user is looking for a file that doesnt exist then redirect them to the perl script which will create a lock file and then create the requested file to disk and also to screen (by redirecting STDOUT). The next person to request the page/url will have it presented to them instantly
If another user asks for the same file whilst the page is being generated, then simply get your Perl script to skip over the file creation method (which is being done by another perl process running - you simply check for the existence of a lock file) and simply display the output to screen. Hopefully once the perl script has finished creating the file on disk (and removed the lock file) any subsequent requests will be redirected to the file and not the cgi/perl script.
In addition to the caching it might also be a good idea to track (using the apache logs) what requests are the most common, if you have 50 urls/pages that are dynamically created and are the most commonly requested pages then create another script that pre-creates them offline (and refreshes them when the data changes).
hth.
Dave......
-->daves_listreader@hotmail.com
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.