Welcome Guest | Login

DRB for mongrel file upload progress plugin

Hi,

I am currently looking into mongrel_upload_progress plugin and the examples use a drb server to query the status of the uploads. I will also use drb in future to do some other tasks.

What port do I run the drb server on? Or is there a global drb server running on every system. I have one port assigned to me in my package but that is being used by mongrel.

Regards
Prateek

2007-07-23 05:38 AM

Hi there - you can append a 0 to the end of your port number and run the drb server there.  For example, if your port was 4782 for mongrel, you can run the DRB server on port 47820

In fact, with the assigned port 4782 you actually have 47820, 47821, etc.. 47829 assigned to you as well. You can run as many static processes as you'd like on these ports as long as you stay within your static memory limit.  

Cheers,
~William  

2007-07-23 05:51 AM

Oh ... so does it mean that the memory taken by Mongrel + DRB should be within the static memory limit ? I thought the static memory limit applies only to mongrel

Also from experience, if I am using rmagick for image resize (in file_column), does it bring down the memory a lot if i switch over to image_magick. I don't know how easy or tough it is but i just wanted to find out

Regards
Prateek

2007-07-23 06:03 AM

Regarding:
---------------
Oh ... so does it mean that the memory taken by Mongrel + DRB should be within the static memory limit ?
--------
Yes

----------
I thought the static memory limit applies only to mongrel
----------
No, the static memory limit applies collectively to all the static process you run on your account.  



Also, if you switch over to using direct system calls to imagemagick (which I would recommend), or even using something like mini_magick, then yes, the memory consumption of your app is will be lower and you'll find things generally more stable.  

2007-07-23 06:23 AM

On top of that . I just bought room for more servers and mongrels. How best would it be to break up these slots? Like running equal drb's and equal mongrels? Or a mix like 6 mongrels and two drbs?
does either know enough dynamically about each other?

2007-08-13 02:17 PM

EDIT: See Luminous' below post for correction on the DRb server

2007-08-13 02:44 PM

Ok thank you.

To start I assume that two drb => :keys will cancel out the other like so
# config/mongrel_upload_progress.conf
uri "/",
 :handler => plugin("/handlers/upload", :path_info => '/file/do_the_upload',
   :drb => 'druby://0.0.0.0:2999',
   :drb => 'druby://0.0.0.0:3004',
  :frequency => 1),
 :in_front => true


# lib/upload.rb, the upload drb server
require 'rubygems'
require 'drb'
require 'gem_plugin'
GemPlugin::Manager.instance.load 'mongrel' => GemPlugin::INCLUDE
DRb.start_service 'druby://0.0.0.0:2999', Mongrel::UploadProgress.new
DRb.start_service 'druby://0.0.0.0:3004', Mongrel::UploadProgress.new
DRb.thread.join


So the question is how do I add more in ? I know how to run more mongrels already.

2007-08-13 03:23 PM

According to the DRB api docs: DRB spawns an independent thread for each request.  So no matter how many requests you're handling only one drb should be running.  So there is no need (and, indeed, no possible way) for you to have more than one DRB server running at once.

2007-08-13 09:21 PM

Rats.....
Hmm so guess that I will have to force a limit of file upload size then. Cause when I try 7 mongrels and the druby I can get upto 356 mb without the server crashing offline.

hmm, off hand is their another way to upload the files ? or is it all forced to a temp file first then transported over ..


2007-08-14 07:07 AM

The single druby server should be able to handle any file size...I don't know of any other way to upload files otherwise...

2007-08-14 04:46 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!