rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* multithreading not working for requests to the same url
@ 2011-01-21 12:47 Mathijs
  2011-01-21 12:59 ` Konstantin Haase
  0 siblings, 1 reply; 3+ messages in thread
From: Mathijs @ 2011-01-21 12:47 UTC (permalink / raw)
  To: Rack Development

Hi all,


In my application, a lot of time is spent on /inbox.
However, it looks as if rack does not support handling multiple
requests to the same url simultaneously.

I used this 'demo' app:
class HelloWorld
  def call(env)
    sleep 15
    [200, {'Content-Type' => 'text/plain'}, ["Hello world!"]]
  end
end
run Helloworld.new

run with rackup demo.ru
open 3 browser tabs, enter these urls:
- http://localhost:9292/path1
- http://localhost:9292/path1
- http://localhost:9292/path2

You'll see that if you start the requests roughly at the same time,
the first path1 and path2 will complete at the same time.
The second path1 comes 15sec behind.

Passing params (localhost:9292/path1?blah=3) will
trick the app to handle the request in parallel. Also, aliasing
localhost does the trick.
So it looks as if rack does some locking per url.
I couldn't find anything though.

I tried this under REE with mongrel and webrick and under jruby with
trinidad and webrick.
They all behave the same.

Is anyone aware of this behavior? What is the cause?
Thanks,
Mathijs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: multithreading not working for requests to the same url
  2011-01-21 12:47 multithreading not working for requests to the same url Mathijs
@ 2011-01-21 12:59 ` Konstantin Haase
  2011-01-21 13:05   ` Mathijs
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Haase @ 2011-01-21 12:59 UTC (permalink / raw)
  To: rack-devel

Concurrency is up to the concrete Rack handler (webserver), not rack.

Konstantin

On Jan 21, 2011, at 13:47 , Mathijs wrote:

> Hi all,
> 
> 
> In my application, a lot of time is spent on /inbox.
> However, it looks as if rack does not support handling multiple
> requests to the same url simultaneously.
> 
> I used this 'demo' app:
> class HelloWorld
>  def call(env)
>    sleep 15
>    [200, {'Content-Type' => 'text/plain'}, ["Hello world!"]]
>  end
> end
> run Helloworld.new
> 
> run with rackup demo.ru
> open 3 browser tabs, enter these urls:
> - http://localhost:9292/path1
> - http://localhost:9292/path1
> - http://localhost:9292/path2
> 
> You'll see that if you start the requests roughly at the same time,
> the first path1 and path2 will complete at the same time.
> The second path1 comes 15sec behind.
> 
> Passing params (localhost:9292/path1?blah=3) will
> trick the app to handle the request in parallel. Also, aliasing
> localhost does the trick.
> So it looks as if rack does some locking per url.
> I couldn't find anything though.
> 
> I tried this under REE with mongrel and webrick and under jruby with
> trinidad and webrick.
> They all behave the same.
> 
> Is anyone aware of this behavior? What is the cause?
> Thanks,
> Mathijs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: multithreading not working for requests to the same url
  2011-01-21 12:59 ` Konstantin Haase
@ 2011-01-21 13:05   ` Mathijs
  0 siblings, 0 replies; 3+ messages in thread
From: Mathijs @ 2011-01-21 13:05 UTC (permalink / raw)
  To: Rack Development

Thanks for the speedy reply.

I found my problem.
It turns out that it was my webbrowser queueing the requests.
Both firefox and chrome do this, but when hitting the same url from 2
different browsers, everything works fine.




On Jan 21, 1:59 pm, Konstantin Haase <k.ha...@finn.de> wrote:
> Concurrency is up to the concrete Rack handler (webserver), not rack.
>
> Konstantin
>
> On Jan 21, 2011, at 13:47 , Mathijs wrote:
>
> 144145
>
> 146
>
>
>
> > Hi all,
>
> > In my application, a lot of time is spent on /inbox.
> > However, it looks as if rack does not support handling multiple
> > requests to the same url simultaneously.
>
> > I used this 'demo' app:
> > class HelloWorld
> >  def call(env)
> >    sleep 15
> >    [200, {'Content-Type' => 'text/plain'}, ["Hello world!"]]
> >  end
> > end
> > run Helloworld.new
>
> > run with rackup demo.ru
> > open 3 browser tabs, enter these urls:
> > -147http://localhost:9292/path1
> > -148http://localhost:9292/path1
> > -149http://localhost:9292/path2
>
> > You'll see that if you start the requests roughly at the same time,
> > the first path1 and path2 will complete at the same time.
> > The second path1 comes 15sec behind.
>
> > Passing params (localhost:9292/path1?blah=3) will
> > trick the app to handle the request in parallel. Also, aliasing
> > localhost does the trick.
> > So it looks as if rack does some locking per url.
> > I couldn't find anything though.
>
> > I tried this under REE with mongrel and webrick and under jruby with
> > trinidad and webrick.
> > They all behave the same.
>
> > Is anyone aware of this behavior? What is the cause?
> > Thanks,
> > Mathijs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-21 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-21 12:47 multithreading not working for requests to the same url Mathijs
2011-01-21 12:59 ` Konstantin Haase
2011-01-21 13:05   ` Mathijs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).