Mongrel upload progress and nginx

I can get the mongrel upload progress plugin to work for my app if I run
my mongrel_cluster behind pound, but it won’t work behind nginx. Is
anyone using nginx as a mongrel frontend with upload progress meters
successfully?
thanks,

Will,

Haven’t tried it, but it is possible that Pound is routing the
successive
requests from each user back to the same mongrel process. This is
important
because each mongrel only knows about it’s own set of uploads unless you
are
using the DRb version of mongrel_upload_progress to synchronize all of
your
mongrels. I’m using the uploader behind Pen with the DRb synchro version
and
it works just fine. Pen is capable of trying to remember which user
belongs
to which backend server, but I’m not using that functionality and am
opting
for DRb to do the sync instead.

Check out the DRb section on:
http://mongrel.rubyforge.org/docs/upload_progress.html

Hope this helps…

Matt

On 11/14/06, Will M. [email protected] wrote:


Thermal Creative
http://blog.thermalcreative.com

Thanks for the reply – I should have mentioned that I am using DRb to
handle the uploads as detailed at
http://mongrel.rubyforge.org/docs/upload_progress.html .

If I am using pound I can see the uploads with irb -r
lib/upload_client.rb , but cannot if I am using nginx.

Matt W. wrote:

Will,

Haven’t tried it, but it is possible that Pound is routing the
successive
requests from each user back to the same mongrel process. This is
important
because each mongrel only knows about it’s own set of uploads unless you
are
using the DRb version of mongrel_upload_progress to synchronize all of
your
mongrels. I’m using the uploader behind Pen with the DRb synchro version
and
it works just fine. Pen is capable of trying to remember which user
belongs
to which backend server, but I’m not using that functionality and am
opting
for DRb to do the sync instead.

Check out the DRb section on:
http://mongrel.rubyforge.org/docs/upload_progress.html

Hope this helps…

Matt

On 11/14/06, Will M. [email protected] wrote:


Thermal Creative
http://blog.thermalcreative.com

Will,

Shoot… I was hoping for simple :wink:

Did a bit of sleuthing, and confirmed my suspicions about NGINX:
http://wiki.codemongers.com/NginxHttpProxyModule

Looks like it buffers the whole request in memory before passing it to
the
backend when you use it as a proxy:

“Note that when using the HTTP Proxy Module (or even when using
FastCGI),
the entire client request will be buffered in nginx before being passed
on
to the backend proxied servers. As a result, upload progress meters will
not
function correctly if they work by measuring the data received by the
backend servers.”

Doh! Ezra beat me to it!

On 11/14/06, Will M. [email protected] wrote:

Matt W. wrote:

mongrels. I’m using the uploader behind Pen with the DRb synchro version
Hope this helps…
Thermal Creative
http://blog.thermalcreative.com


Posted via http://www.ruby-forum.com/.


Thermal Creative
http://blog.thermalcreative.com

On Nov 13, 2006, at 2:17 PM, Will M. wrote:

I can get the mongrel upload progress plugin to work for my app if
I run
my mongrel_cluster behind pound, but it won’t work behind nginx. Is
anyone using nginx as a mongrel frontend with upload progress meters
successfully?
thanks,

Hey Will-

Unfortunately nginx doesn't work with the mup right now. Nginx

always buffers the upload to disk before passing it to mongrel. So by
the time mongrel getr notified, the entire upload has already taken
place. The author of nginx is aware of this and is going to either
allow pass thru uploads or implement an nginx upload_progress module.

For now you have to use another form of load balancer to send upload

requests directly to mongrel. Since the file upload happens in an
iframe, the trick I have used is to run one mongrel on a higher port
to handle the uploads. Since it gets used in an iframe the user won’t
ever see the port number. And if you need ti to work through
firewalls and you arent using ssl you can run the upload mongrel on
port 443 instead of ssl. That way no firewalls block it. Then that
mongrel just redirects to the normal mongrels to finish up the upload.

Nginx gets updated very often. So I hope there will be a way to do

this with nginx very soon.

Cheers-
– Ezra Z.
– Lead Rails Evangelist
[email protected]
– Engine Y., Serious Rails Hosting
– (866) 518-YARD (9273)