On Oct 30, 2006, at 1:11 AM, cwinl wrote:
hi,all i am a newbie to libevent. i use libevent to build my application's network framework. it works well. but there are still some questions about it. data reading from network work very well. but data i want to write to network are not very reliable when about 200 clients connect to my server. i write data to client using method "bufferevent_write" , but sometimes clients get the data after 7 or 8 seconds. here are my main code, any suggestion are regarded. thank you!
I doubt your problems are because of incorrect use of bufferevent_write. I bet one of the following things is happening:
1) You're only getting around to each socket every 7 or 8 seconds. Try adding some instrumentation to see where the time is going. (gettimeofday() for wall-clock time, getrusage() for CPU time.) It's probably in "my_own_biz_code()".
2) You've saturated your network connection. How fast can you send data, and how fast are you sending data? On Linux, "sar -n DEV 1000 1" will show you bandwidth utilization every second (for 1000 seconds).
-- Scott Lamb <http://www.slamb.org/> _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkey.org/mailman/listinfo/libevent-users