What is the server load when uploading files?

It isn’t a secret that Rails doesn’t handle uploads in the best possible
way, but what are the limits of this?

I have a site that on a typical post will contain 5- 10 picture uploads
each of which will have a size of ~100 - 300 kB. The current server
setup consists of a 4 unit mongrel cluster. Will Rails/Mongrel be able
to handle one person uploading 10 files as well as serving 10 other
simple GET requests?

If not are there any common ways around this? ex uploading each file in
a separate form POST via javascript (that is the only thing that I can
think of right now).

Thanks for the help.

On 29 Mar 2008, at 18:02, iso … wrote:

simple GET requests?

If not are there any common ways around this? ex uploading each
file in
a separate form POST via javascript (that is the only thing that I can
think of right now).

If you’re submitting all files from one single form, you shouldn’t
worry all too much, the mongrel will still be serving requests during
the uploads themselves. It’s when the uploading is finished that the
mongrel will be locked by the single-threaded Rails processing request.

Another option is for you to use a small merb (which is multithreaded)
application on a mongrel (with its own port). Then use the apache/
nginx rewrite rules to rewrite certain urls to the merb application
(e.g. every url that has the term “upload” in it).

Best regards

Peter De Berdt

Thanks Peter,

That cleared things up a bit.

It’s when the uploading is finished that the
mongrel will be locked by the single-threaded Rails processing request.

Is it during the ImageMagick processing of the files that it is locked
up for? As you could tell I was under the impression it was during the
upload which is obviously a lengthy period of time, so I am little off
in left field with my understanding. :slight_smile:

I have heard that Merb is a good way to upload the files. I was waiting
for some good documentation and examples to come out now that things
have stabilized.

Thanks again

On 29 Mar 2008, at 19:12, iso … wrote:

Is it during the ImageMagick processing of the files that it is locked
up for? As you could tell I was under the impression it was during
the
upload which is obviously a lengthy period of time, so I am little off
in left field with my understanding. :slight_smile:

Yes, and ImageMagick processing can take a while. In this case, there
is a third option btw, and that’s that you hand the file(s) over to
backgroundrb for processing.

I have heard that Merb is a good way to upload the files. I was
waiting
for some good documentation and examples to come out now that things
have stabilized.

Although not everything might still use exactly the same api, there
are some blog posts out there that already explain the procedure:

HTH!

Best regards

Peter De Berdt

It doesn’t do multiple concurrent file uploads. I’m fairly sure that’s
a limitation of the HTTP protocol if you’re using standard forms. To
get multiple concurrent file uploads, you’d need to use AJAX or Flex,
I reckon.

Julian.

Learn about Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME)
http://sensei.zenunit.com/