http://www.perlmonks.org?node_id=19426


in reply to CGI and Server-load

If you really need to do the analysis online in real-time and not as batch logfile anaysis (as mentioned above) I see 2 posibilities:
  1. Real-time log analysis. Have a process that tails the access logs and counts hits in real-time. This saves the overhead of having to launch a separate process each time you want to increment a count.
  2. Use mod_perl. With mod_perl you can run perl inside of apache so you don't have the overhead of launching a separate process. With Apache::Registry you can even use your current cgi-bin perl programs with no modification and get the "run inside of apache w/o a separate process" advantage.

Replies are listed 'Best First'.
RE: Re: CGI and Server-load
by muppetBoy (Pilgrim) on Jun 22, 2000 at 17:48 UTC
    mod_perl would remove the process launch overhead, but he's using IIS - mod_perl just works with Apache doesn't it?
    I think the Real-time option is the better one - the server already does logging for you so it seems to me like a good idea to use the information that is provided. I don't know what logging IIS has but there must be something.
    I would be tempted to use a cron job (or similar) and grab the stats on a daily basis.
      Yes, mod_perl only works with Apache. The original question didn't state anything about IIS so I assumed apache (I should have mentioned that assumption in my original post). I think its a safe bet that most perl users are using Apache instead of other web servers.

      Of course, depending on how the script is called the user can set up his script on a separate, dedicated "hit counting" box running Apache (easy to repuppose an old PC as a linux box for this purpose in many environments) he would be set. Or maybe use the first of those new sun boxes they're getting to build a new hit-counter box. Good way to test the new hardware and you don't have to migrate the whole system to sun to get it to work.