Re: Q: How to improve CGI performance for this?



Jim Gibson wrote:

Something as simple as putting a sleep(1) in your code will slow
down responses. You can sleep for variable amounts of time, if
necessary.

I thought of this, but it seems that it won't help much. Since this is
a chat bot, the load mostly comes not from a single user chatting
too fast, but from too many users chatting at the same time - I think
that although this will have some effect, it will be small. But thanks
for the idea anyway.

You might consider putting your data into an indexed database
and doing indexed queries.

Good idea. I just finished writing the script to use such an index,
loaded from a file (not actual DB) using Storable (great module this
one, easy to use too!). Basically I rewrote some of the script logic
and now I have a script tha tis exactly 2.5 times faster! I was
hoping for more, but even this is significant improvement.

The last thing that I'm going to do now is to make the script to
check /proc/loadavg and to stop if the server is very busy. I hope
this will be enough to keep my hosting provider happy, :-)

Thank you all for your help and great advice!

Regards,

- Alex

.



Relevant Pages

  • Re: Sleep command quitting
    ... It cannot be that the `sleep` command is terminating. ... That script was popular when I started working at SCO Support in 1989. ... it doesn't really hold the settings you specify. ... anything else comes along and makes further changes, the holdopen script ...
    (comp.unix.sco.misc)
  • Re: WScript.dll not working
    ... But, when i call a script indirectly in my application's exe's context, then it doesn't repond further. ... the sleep method is coded into the ... could call the sleep api directly from script. ...
    (microsoft.public.scripting.vbscript)
  • Re: Rename File Using Strring Found in File?
    ... OK, thanks, but the script does not seem to rename the files. ... # sleep 1; ... to the string in this particular file that I want to match. ...
    (comp.lang.perl.misc)
  • my script crashes when I try to rename the file!
    ... OK, thanks, but the script does not seem to rename the files. ... You can set the working directory from within your Perl ... # sleep 1; ... to the string in this particular file that I want to match. ...
    (perl.beginners)
  • Re: how to run script after suspend to disk - but I have a problem with it.
    ... for sleep. ... The script in the action directory tells the ... the machine in suspend to memory mode. ... rmmodule $mname ...
    (Fedora)