Hi, i am looking for a proxy sample code using libevent and have found le-proxy on levent svn. after checked out the rev.1432, i compiled and run le-proxy as a http proxy, but found its performance is so poor. about 10hits/second (the requested page is 1k bytes) on 2 p4 machines (linux kernel 2.6.27) (i tried it on 2 different machines), on the same machines, another thread-based proxy can do more than 300hits/second.
so i did a quick hack, i removed all BEV_OPT_DEFER_CALLBACKS from le-proxy.c, and gain a dramatic performance boost, about 800hits/second. according to http://www.wangafu.net/~nickm/libevent-book/Ref6_bufferevent.html, "Deferred callbacks: .... This immediate invocation can make trouble when dependencies get complex. For example, suppose that there is a callback that moves data into evbuffer A when it grows empty, and another callback that process data out of evbuffer A when it grows full. Since these calls are all happening on the stack, you might risk a stack overflow if the dependency grows nasty enough." is there really such a risk of stack overflow in le-proxy.c? it has only one process, and i assume the callbacks are called in a single thread. i am new to libevent, any advise will be appreciated. thanks. _______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://monkeymail.org/mailman/listinfo/libevent-users