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:

  1. a comet api (see comet.c example)
  2. a streaming api (see stream1/2/3.c examples)
  3. a transparent asynchronous interface avoid blocking i/o.

so, if want see how g-wan processes real-life slow scripts, write realistic code.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -