Uploading 2+ files simultaneously

I’m having trouble uploading 2+ files simultaneously (from different
client machines)…

the upload page just hangs…

I’m running…

  • ruby 1.8.4 (2005-12-24) [i686-linux]
  • rails 1.1.4
  • red hat el 4
  • apache
  • fcgi (0.8.7, 0.8.6.1)
  • firefox 1.5.0.5
  • httpd.conf
FastCgiIpcDir /tmp/fcgi_ipc/ AddHandler fastcgi-script .fcgi FastCGIConfig -minProcesses 2

thoughts/suggestions?

I am having the same type of problems. I am running apache with 2
fastcgi
instances. What is happening is each fastcgi instance is blocking
during a
file upload, so if 2 people are uploading files then both fastcgis are
being
blocked and no other web requests are processed. What is a solution to
this
problem?

Run more FCGI instances?

I believe there are also some (really excellent) solutions forming
around Mongrel.

I am running 2 FCGI instances and they use about 22MB a piece. I can’t
add
too many more without maxing out my 128MB VPS box. Anyone know how
37signals guys handle this with backpack, etc? I’ll keep an eye out on
Mongrel.

Hi,

I don’t know what the solution to this problem is, however I’m having
the exact same issues. If anyone has suggestions regarding how to
handle this with FCGI, I would also appreciate it!

-Steven

I’m starting to feel like this is an issue that does not have a
resolution,
which would mean that it would not possible to create a rails app with
multiple people uploading at the same time on anything less than a
dedicated
box. Is this really true?

You need to add more dispatchers. You also need to make sure you can get
the
file there in a reasonable amount of time… some hosts have a timeout
on
fastcgi so if the upload takes too long, it will just disconnect the
client.

The solution is to scale up. Rails requests are single-threaded.

The “big guys” are running lots of dispatchers on multiple machines. I
think
someone on here from Strongspace mentioned that they currently use 20
dispatchers, but don’t quote me on that.

People are working on plugins for Mongrel that offload the file uploads
to a
different process and then pass the file to Rails when the upload is
done. I
don’t know how that’s coming but perhaps someone else can shed some
light on
this.

Beware: this is not just a problem with file uploads… it’s a problem
with
requests and Rails in general. If your machine can only handle 5
requests
per second, then your 6th person is going to wait until someone else is
done. They requests will queue up and you will see terrible performance
unless you load-balance with multiple dispatchers.

Brian, thanks a ton for your excellent response!