From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Is a client uploading a file a slow client from unicorn's point of view?
Date: Tue, 9 Oct 2012 16:54:35 -0700 [thread overview]
Message-ID: <20121009235435.GA29908@dcvr.yhbt.net> (raw)
In-Reply-To: <3EDF9F45-B5FB-4C3B-B0E5-37C28ECFE1D1@toom.ee>
Laas Toom <laas@toom.ee> wrote:
> On 09.10.2012, at 23:03, Eric Wong <normalperson@yhbt.net> wrote:
> > Laas Toom <laas@toom.ee> wrote:
> >> Afterwards it will only handle out the file location and Rails can
> >> complete it's work a lot faster, freeing up workers.
> >>
> >> Unicorn won't even see the file and Rails has the responsibility to
> >> delete the file if it's invalid.
> >
> > I think the only problem with this approach is it won't work well on
> > setups where nginx is on separate machines from unicorn. Shared
> > storage would be required, but that ends up adding to network I/O,
> > too...
>
> But won't (almost) the same network I/O be evident anyway, because of
> nginx transferring the data to Unicorn over network (as they are on
> different machines)?
It depends on your shared storage implementation.
It'll likely be a win if the shared storage is on the same server as
nginx (but that might mean you can only have one nginx server). But I
think it'll be a loss if there needs to be multiple nginx servers (and
multiple unicorn servers)...
* With nginx_upload_module + shared storage:
nginx server ------ shared storage -------- unicorn server
------------------------------------------------------------------
1. sequential write to shared storage
2. file could remain cached do processing on file parts
on nginx server, even if remotely, network latency
we'll never need to read from reads (and possible cache
it again coherency checks on rereads)
3. unlink on error unlink/rename/copy on success
* Without nginx_upload_module:
nginx server -------------------------- unicorn server
------------------------------------------------------------------
1. sequential write of tempfile
2. sequential read of tempfile ----------> sequential write by Rack
3. unlink (able to free up cache) do processing on file locally
(no remote cache coherency
checks)
The benefit of this approach is there's only 2 components interacting at
any one time, and the network costs are paid in full up front
Basically, it's the message passing concurrency model vs shared
memory+locking. There's no clear winner, it just depends on the
situation. 99% of the time I get away with keeping everything on
one machine :)
_______________________________________________
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
next prev parent reply other threads:[~2012-10-09 23:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 0:39 Is a client uploading a file a slow client from unicorn's point of view? Jimmy Soho
2012-10-09 1:58 ` 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 [this message]
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=20121009235435.GA29908@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--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).