2

I was hoping that someone would be kind enough to confirm how hypnotoad and workers...well work :)

If for example my client code has a loop ( i.e for each ) that calls the same route with a different argument on each iteration.  Is it possible that each call to the backend will be handled by a different worker ad therefore simultaneously? ( if there are free workers?) 

I know this is a basic question but any help is appreciated

Thanks. 

4

1 回答 1

1

Hypnotoad is a preforking server. It means, if you have 4 processor cores, you can run for example 4 workers. If one of them is busy because of blocking code sleep(10), another one will handle next connection and so on.

You can try it yourself. Just write this code, "sleep 5; $self->render_text('5 seconds')" set a "workers" option to 2 or more and try to load a page 2 times simultaneously

If your code is absolutely non-blocking, one worker can handle many connections simultaneously but it will execute it one-by-one.

于 2013-01-29T23:07:19.500 回答