Welcome Guest | Login

Need help with getting started with Drb Druby and rails.

I saw that Mongrel Upload needs to use Druby for speeding up its uploader and not slowing down the site for others. Among that Druby seems to handle traffic better with sessions.

The problem is. I have no clue how to start with druby and rails. 
There does not seem  to be a concrete tutorial to study from for rails that i can find yet.


Anyone like to chime in a little on the topic ?

2007-08-09 12:57 PM

Just like you have your mongrel servers set up, you'll also need to have a DRuby process set up (note that your DRuby memory counts against the memory allocation on your account, you will probably need to give up a mongrel process in order to run druby).  You'll also need to use one of the mongrel ports assigned to you (a 5-digit port that starts with a '4')

First, set up your configuration for mongrel into config/mongrel_upload_progress.conf.  Remember to replace the port number (shown here as 4***9)
uri "/", 
 :handler => plugin("/handlers/upload",
   :path_info => '/files/upload',
   :drb => 'druby://0.0.0.0:4***9'),
 :in_front => true
Create a file in your lib directory called 'upload.rb'
This ruby file is an independent server that is totally separate from your rails application.  Remember to replace the port number again.  In the file, put:
require 'rubygems'
require 'drb'
require 'gem_plugin'
GemPlugin::Manager.instance.load 'mongrel' => GemPlugin::INCLUDE
DRb.start_service 'druby://0.0.0.0:4***9', Mongrel::UploadProgress.new
DRb.thread.join
To start the druby server:
ruby ~/path/to/app/lib/upload.rb
You can see it running with:
ps aux
And stop it with:
kill (PROCESSID)
All this documentation and more is available from:http://mongrel.rubyforge.org/docs/upload_progress.html

2007-08-09 03:34 PM

Oh thank you. Hmmm it seems that when I run ruby lib/upload.rb in the or ruby  ../appname/lib/upload.rb
It just sticks and never gives me command prompt anymore.

2007-08-09 04:42 PM

You might try
ruby lib/upload.rb &
But I don't know if the process will stay resident when you log out of your ssh session.  Please try that and let me know.  The process has always backgrounded in the past automatically for me.

2007-08-10 11:39 AM

Sweet! such a tiny missed step, & crazy,, back to the books for me.
Now on that, can you recommend any extra tools I can use to test out how fast this thing really is going or helping?
I know we should buy some more memory for the server to run more mongrels,

But aside from that I have been unsuccessful in uploading files larger than 400+ megs yet.


2007-08-10 12:03 PM

Can you be more specific on what happens when you try uploading something larger than 400 megs?  Do you get any errors in your mongrel.log or production.log?

2007-08-10 07:45 PM


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