rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: Mathijs <bluescreen303@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: multithreading not working for requests to the same url
Date: Fri, 21 Jan 2011 04:47:10 -0800 (PST)	[thread overview]
Message-ID: <97f5216f-a83e-439d-9fcc-bb241df23037@m13g2000yqb.googlegroups.com> (raw)

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

             reply	other threads:[~2011-01-21 12:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 12:47 Mathijs [this message]
2011-01-21 12:59 ` multithreading not working for requests to the same url Konstantin Haase
2011-01-21 13:05   ` Mathijs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97f5216f-a83e-439d-9fcc-bb241df23037@m13g2000yqb.googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).