> I'm getting strange behavior with uGreen. First of all, I'm using nginx
> 1.0.4 and uWSGI 0.9.8 (uWSGI 0.9.8 (32bit) on [Sat Jun 11 08:57:38 2011]).
> I'll post my configurations further down as well, but first the problem.
> My tests are using a single nginx worker, and a single uwsgi worker with
> two async cores (so I should be able to handle two asynchronous requests
> at a time if I use uGreen properly).
yes, right
>
> def application(e, s):
> s('200 OK', [('Content-Type', 'text/html')])
> uwsgi.async_sleep(5)
> return ['Hello world']
>
> This should be able to handle two asynchronous requests that finish at the
> same time. Instead however, the first request finishes first, and only
> then does the second request start.
Here the code is wrong, uwsgi.async_sleep only inform the schedueler to
wait for 5 seconds after the first suspension so it should be written as
def application(e, s):
s('200 OK', [('Content-Type', 'text/html')])
yield uwsgi.async_sleep(5)
yield 'Hello world'
or
def application(e, s):
s('200 OK', [('Content-Type', 'text/html')])
uwsgi.async_sleep(5)
uwsgi.suspend() # here the sleep will start
return ['Hello world']
>
> def application(e, s):
> s('200 OK', [('Content-Type', 'text/html')])
> for i in xrange(5):
> uwsgi.async_sleep(1)
> yield 'Yielding %s<br/>' % time.time()
>
> Opening two tabs at the same time, and the output I see is the following.
> In tab 1:
>
>
You cannot test in this way, the vast majority of the browser do not send
concurrent requests to the same url. You should use something like curl or
two different browsers.
Hope it can be useful
--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi