These may be a silly questions, but just to cover all bases...

Are you watching for an EV_WRITE event while you have nothing to write?

Are you attempting to send more data in a single send() than the socket's
SO_SNDBUF and SO_SNDLOWAT allow?

As I type these, I realize the latter question is a better fit for your
problem description.


On 4/25/06 3:07 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> 
> Hello, all ...
> 
> I'm still learning libEvent, so maybe there is something I can do to
> fix this.  I've a very basic C++ server based on libEvent, and i'm
> having the server stream 1 MPEG2 PS (6-8mbps) file to 1 client over
> HTTP.  The client is VLC.  While this works, the CPU usage is very
> high e.g. 90+% on both my PowerBook (running OSX 10.4.6) and a (much
> faster) Debian Sarge box running on a 2.4ghz P4.  This CPU usage is
> the server only -- the VLC client is on another machine.
> 
> The program sits inside event_dispatch() and doesn't come out until
> the client disconnects.  Furthermore, if I use VLC to stream the same
> file over RTP, it only uses 2-4% of the CPU, not 90+%.
> 
> I'm very new to libEvent, but is there something I can do to make the
> CPU usage of my libEvent-based server more inline with what VLC
> uses?  If I do an strace (on Linux) or a ktrace (on OSX), I see the
> same calls -- epoll_ctl(), a send() which returns EAGAIN (since I
> made the socket non-blocking), and that's about it.  Is there a call
> I can make into libEvent before I call event_dispatch() that will
> make libEvent not spin so heavily on the select() / kqueue / epoll()?
> 
> Regards,
> 
> John
> 
> Falling You - exploring the beauty of voice and sound
> http://www.fallingyou.com
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Libevent-users mailing list
> Libevent-users@monkey.org
> http://monkey.org/mailman/listinfo/libevent-users


_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to