# What is the server load when uploading files?

**URL:** <https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276>\
**Category:** Rails\
**Created:** [March 29, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276 "2008-03-29T18:02:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumwutdum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@sumwutdum](https://www.ruby-forum.com/u/sumwutdum)\
**Post date:** [March 29, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276/1 "2008-03-29T18:02:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sumwutdum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@sumwutdum](https://www.ruby-forum.com/u/sumwutdum)\
**Post date:** [March 29, 2008, 6:16pm UTC](https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276/2 "2008-03-29T18:16:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sumwutdum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@sumwutdum](https://www.ruby-forum.com/u/sumwutdum)\
**Post date:** [March 29, 2008, 7:12pm UTC](https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276/3 "2008-03-29T19:12:07Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![sumwutdum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@sumwutdum](https://www.ruby-forum.com/u/sumwutdum)\
**Post date:** [March 29, 2008, 8:00pm UTC](https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276/4 "2008-03-29T20:00:04Z")

</div>

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

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:

> **[RunScribe - Wearable IMU - Gait Analysis](https://runscribe.com)**
>
> RunScribe is a comprehensive gait analysis platform for hiking, running, and walking (coaches, podiatrists, physical therapists, gait labs, etc). By capturing data on both feet at every step, RunScribe provides a detailed view of gait mechanics in...

> **[railspikes.com - This website is for sale! - railspikes...](http://ww16.railspikes.com/2007/4/1/merb?sub1=20230710-1443-0731-854a-183fd2ac1bdd)**
>
> This website is for sale! railspikes.com is your first and best source for all of the information you’re looking for. From general topics to more of what you would expect to find here, railspikes.com has it all. We hope you find what you are...

HTH!

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![sumwutdum](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b77776/32.png) [@sumwutdum](https://www.ruby-forum.com/u/sumwutdum)\
**Post date:** [March 31, 2008, 6:43am UTC](https://www.ruby-forum.com/t/what-is-the-server-load-when-uploading-files/133276/5 "2008-03-31T06:43:35Z")

</div>

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/](http://sensei.zenunit.com/)
