On Sat, Jun 03, 2006 at 10:57:10AM -0700, [EMAIL PROTECTED] wrote: > I've also had issues with high CPU usage over a select-based > algorithm (on Gentoo Linux using epoll() as well as Mac OSX using > kqueue()), though i'm not sure if it's due to libevent or just my > code. The thing about 1-second timers is that I want to use libevent > to write a video server, so if there is space on a socket to send > bytes, I want to send them immediately rather than wait until the > timer expires.
I have written a DVB stream application which is also capable of streaming via HTTP *urgs* - So what i do is that i simple issue a bufferevent_write... as soon as i have data available. To make shure i am not using up all memory by queing gigabytes on a slow client i am checking the amount of queued data via EVBUFFER_LENGTH(bufferevent->output) and drop the connection if i fail to queue data multiple times. For top notch performance i would not use the bufferevent API because it involves a lot of duplicating buffers in userspace. Typically i will send the same data buffer to multiple clients. Sending this via bufferevent makes a copy per socket. I'd rather use some linked list of buffers in which i do refcounting. Every time i queue up a buffer on a socket i refcount it up by one, everytime i send it out i'll refcount it down. On zero i free it because it has been sent to all clients. Flo -- Florian Lohoff [EMAIL PROTECTED] +49-171-2280134 Heisenberg may have been here.
signature.asc
Description: Digital signature
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users