Our site is suddenly getting to the point where resource constraints are
becoming an issue for the first time. So, apologies in advance if I have
lots of optimization-related questions over the next couple of weeks...

One thing I would like to catch is the related problems of:
 - Users pressing stop in the middle of a long process
 - Users double-clicking rather than single-clicking links
   (resulting in 2 processes handling the request)

I've read the 'user-pressed-stop' bit of the Guide (thanks Stas!) and
although I think I understand the issues now, I'm looking for practical
advice on approaches people use. I'm thinking that I should try writing a
null byte to the client:
 - At the beginning of the handler
 - Every few iterations of potentially long loops
 - Before creating large files to send to the client.

If I do this then Apache should receive the signal that the client has gone
away, and should terminate the process happily (as long as I clean up
properly, of course).

So, does this sound like the right approach? Any way to simplify this to
avoid explicitly adding print-a-null-byte lines to every loop? I'm wondering
whether it's possible to add an alarm() and SIG{ALRM} handler or something
like that, which sends a null byte every second or 2. Anyone using something
like this successfully? Any potential problems from sending a null byte to a
client?


Reply via email to