Scaling Upload in Rails Application?

I always got scared when my client ask for upload functionality.
Basically
from what I’ve read that when user uploaded a file it will an instance
of
the web server. So if i have one dyno (instance) on heroku, while one
user
is uploading a big file then the application would not respond to
another
user request until the file is done ?

I also find a couple of solution like carrierwave-direct which the file
is
uploaded directly to the storage server (let say S3), then rails can
latter
process the file. If we are to build like a social networking which
involves many user uploading file in the same time, what is the correct
approach to the problem?

Ahmy Y

One solution is to use transloadit.com and bypass the server entirely.

On Tue, Mar 27, 2012 at 11:25 AM, Frederick C. <

I got this from the heroku documentation

Pass-through uploads

Pass-through uploading sends the file from the user to the application
on
Heroku which then uploads it to S3.

Benefits of this approach include the ability to pre-process
user-uploads
before storing in S3. However, be careful that large files dont tie up
your application dynos during the upload process.

Large files uploads in single-threaded, non-evented environments (such
as
Rails) block your applications web dynos and can cause request
timeoutshttps://devcenter.heroku.com/articles/request-timeout
and H11, H12 errors
https://devcenter.heroku.com/articles/error-codes.
EventMachine, Node.js and JVM-based languages are less susceptible to
such
issues. Please be aware of this constraint and choose the right approach
for your language or framework.
I think that i uses thin underneath the rails application. So does that
mean, rails is not suited for file upload ?

Ahmy Y.

On Mar 27, 11:56am, Ahmy Y. [email protected] wrote:

I always got scared when my client ask for upload functionality. Basically
from what I’ve read that when user uploaded a file it will an instance of
the web server. So if i have one dyno (instance) on heroku, while one user
is uploading a big file then the application would not respond to another
user request until the file is done ?

Exactly when the file upload gets handed over to rails will depend on
your precise setup. On a standard apache/passenger type setup the
request only gets passed into rails when the request has been fully
received. I’ve not used heroku for this sort of stuff - it should be
say enough to determine what exactly happens.

I also find a couple of solution like carrierwave-direct which the file is
uploaded directly to the storage server (let say S3), then rails can latter
process the file. If we are to build like a social networking which
involves many user uploading file in the same time, what is the correct
approach to the problem?

S3 does indeed support pre-authenticated uploads. I’d certainly
investigate this, since with heroku you’re going to have to upload the
file to s3 (or similar) at some point anyway, seems like you might as
well send it straight there.

Fred