unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jimmy Soho <jimmy.soho@gmail.com>
To: mongrel-unicorn@rubyforge.org
Subject: Is a client uploading a file a slow client from unicorn's point of view?
Date: Tue, 9 Oct 2012 11:39:45 +1100	[thread overview]
Message-ID: <CAHStS5iqBqJxoPZGEUaSHL2qSVf_tfZfbdedc_bRcjcTbcKwAQ@mail.gmail.com> (raw)

Hi All,

I was wondering what would happen when large files were uploaded to
our system in parallel to endpoints that don't process file uploads.
In particular I was wondering if we're vulnerable to a simple DoS
attack.

The setup I tested with was nginx v1.2.4 with upload module (v2.2.0)
configured only for location /uploads with 2 unicorn (v4.3.1) workers
with timeout 30 secs, all running on 1 small unix box.

In a few terminals I started this command 3 times in parallel:

   $ curl -i -F importer_input=@/Users/admin/largefile.tar.gz
https://mywebserver.com/doesnotexist

In a browser I then tried to go a page that would be served by a unicorn worker.

My expectation was that I would not get to see the web page as all
unicorn workers would be busy with receiving / saving the upload. As
discussed in for example this article:
http://stackoverflow.com/questions/9592664/unicorn-rails-large-uploads.
Or as https://github.com/dwilkie/carrierwave_direct describes it:

  "Processing and saving file uploads are typically long running tasks
and should be done in a background process."

But I don't see this. The page is served just fine in my setup. The
requests for the file uploads appear in the nginx access log at the
same time the curl upload command eventually finishes minutes later
client side, and then it's handed off to a unicorn/rack worker
process, which quickly returns a 404 page not found. Response times of
less than 50ms.

What am I missing here? I'm starting to wonder what's the use of the
nginx upload module? My understanding was that it's use was to keep
unicorn workers available as long as a file upload was in progress,
but it seems that without that module it does the same thing.

Another question (more an nginx question though I guess): is there a
way to kill an upload request as early as possible if the request is
not made against known / accepted URI locations, instead of waiting
for it to be completely uploaded to our system and/or waiting for it
to reach the unicorn workers?


Cheers,
Jim
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

             reply	other threads:[~2012-10-09  0:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09  0:39 Jimmy Soho [this message]
2012-10-09  1:58 ` Is a client uploading a file a slow client from unicorn's point of view? Eric Wong
2012-10-09  6:31   ` Laas Toom
2012-10-09 20:03     ` Eric Wong
2012-10-09 23:06       ` Laas Toom
2012-10-09 23:54         ` Eric Wong
2012-10-10  6:59           ` Laas Toom

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-all from there: mbox

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

  List information: https://yhbt.net/unicorn/

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

  git send-email \
    --in-reply-to=CAHStS5iqBqJxoPZGEUaSHL2qSVf_tfZfbdedc_bRcjcTbcKwAQ@mail.gmail.com \
    --to=jimmy.soho@gmail.com \
    --cc=mongrel-unicorn@rubyforge.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

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).