Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: File Server for cgi scripts

by tantarbobus (Hermit)
on Aug 12, 2004 at 00:01 UTC ( #382129=note: print w/replies, xml ) Need Help??

in reply to File Server for cgi scripts

First off, are you using mod_perl because that will give you a much better performance increase than trying to optimise the reading of a file.

Even if you are why not just let the OS handle deciding what files to keep in memory? And instead look for other bottlenecks in your code for which you will get a better return on your effort?

If don't like the idea of trusting the OS to decide what files to cache, and you really want to make it faster because this is where the bottleneck is(which I doubt), you could just use a ramdisk/tmpfs and copy the files there before using them. That way you can get the extra performance while still keeping a simple interface in your script (open, read close) with fewer dependances. Although you will probably not get the performance increase that you were expecting because the OS is normally pretty darn good at caching files.

You might also want to look into FastCGI which allows you to run a cgi as a persistent process external to the webserver, and then the webserver connects to the CGI over TCP or a UDS.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://382129]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2019-10-17 01:07 GMT
Find Nodes?
    Voting Booth?