/ Zope / Apsis / Pound Mailing List / Archive / 2004 / 2004-06 / simple patch: pound unbuffered stream/stdout/stderr

[ << ] [ >> ]

[ I thought it was not a good idea to launch ... ] [ Understanding how SSL is handled / ... ]

simple patch: pound unbuffered stream/stdout/stderr
Sascha Ottolski <sascha.ottolski(at)gallileus.de>
2004-06-30 16:25:49 [ FULL ]
Hi,

just in case someone else wants to have pound

- send streams unbuffered
- write log messages to stderr/stdout unbuffered,

the attached patch could help you. My knowledge about C is quite 
limited, therefore I'm sure the same thing could be achieved better 
(setvbuf?), and may be flushing of stderr isn't necessary at all, but 
at least it seems to work :-)

May be this could be included into the official tree as a 
configure/compiletime choices?


Cheers,

Sascha
[...]

Re: simple patch: pound unbuffered stream/stdout/stderr
Robert Segall <roseg(at)apsis.ch>
2004-06-30 16:36:26 [ FULL ]
On Wednesday 30 June 2004 16.25, Sascha Ottolski wrote:[...]

For your information: on all systems I know stderr is unbuffered, so flushing 
it is not necessary. Flushing stdout is good only for terminal output - on 
files/pipes it loses (extra writes which the buffering prevents); on high 
throughput systems using something like daemontools this may be a problem.

Flushing the BIO on reply is problematic - it may produce many more packets 
than normal when writing, and thus create performance issues.

I may consider something like this only if there is overwhelming demand from 
others on the list - please let me know.[...]

Re: simple patch: pound unbuffered stream/stdout/stderr
Sascha Ottolski <sascha.ottolski(at)gallileus.de>
2004-06-30 17:30:22 [ FULL ]
Am Mittwoch, 30. Juni 2004 16:36 schrieb Robert Segall:[...]

thats what "man stderr" says, I wasn't sure if I could rely on this. I 
think the best thing would be to use setbuf() once to set the mode when 
opening the stream, instead of fflush()ing after every write. I just 
had no idea where I had to put it :-)
[...]

I wanted the unbuffered thing _because_ I use daemontools/multilog. At 
least while testing its very annoying if you can't see whats going on 
immediately. And, hmm, does apache buffer its logfile output?
[...]

That part is not by me personally. Might there be a better solution to 
have the same effect? We need that the result of a response.write() 
immediately goes through the client; otherwise, if such writes are 
small, the user might see nothing for a while. If the webserver doen't 
see a need to buffer the response, why would pound? :-) We have a 
simple python (zope) test script, if anyone is interested.
[...]

I hope there is :-)


Cheers,

Sascha
[...]

MailBoxer