timeout - Response Time of sleeping gwan server script -
i want figure out how gwan responds if script takes longer 1 second finish.
to so, used sleep()
function in hello.c
example:
#include "gwan.h" #include <unistd.h> int main(int argc, char **argv) { sleep(5); static char msg[] = "hello, ansi c!"; xbuf_ncat(get_reply(argv), msg, sizeof(msg) - 1); return 200; // return http code (200:'ok') }
the response time got chrome >= 5 seconds, expected.
then, have run weighttp concurrency test, , here response time got chrome in ms (millisecond).
caching issue? 5 second sleep time has gone? thanks.
your sleep(5);
test pointless (at best) and, expected, g-wan timeouts blocking script avoid blocking server because of buggy script.
if blocking servlet used under concurrency, lik eyou did later, then, instead of pointlessly timing-out every execution (this take time), g-wan flags servlet buggy , no longer executes it.
this blocking issue not exist more interesting test: see how g-wan can serve 10-second system ping without ever blocking.
if have script needs 5 seconds job should not wait 5 seconds. blocking server thread least intelligent thing do.
if server, , say, use single-threaded program nginx, prevent new connections being processed: server dead.
g-wan better because (a) uses several threads , (b) because has dedicated aynchronous interfaces, see below.
for replies span on long period of time g-wan offers:
- a comet api (see comet.c example)
- a streaming api (see stream1/2/3.c examples)
- a transparent asynchronous interface avoid blocking i/o.
so, if want see how g-wan processes real-life slow scripts, write realistic code.
Comments
Post a Comment