Topic: periodically_call_remote & WEBrick poor performance


I'm getting very poor performance when using
periodically_call_remote() in a Rails application. By poor performance
I mean that pages don't refresh at the requested interval (specified
in the periodically_call_remote args). Moreover, if I open more
browsers, the refresh time decreases even more.

Right now I have the frequency set to 5 seconds, and the update sends
back to the browser approx. 1200 bytes. I tested with 1 browser
(refresh rate is 5 sec), 4 browsers (refresh rate is 8 sec) and 10+
browsers (refresh rate varies between 7 sec and 25 sec). I understand
that the refresh rate is higher than 5 seconds since you need to
account for the request/reply time, but I refuse to belive it can't
scale better.

I made sure that periodically_call_remote() is called properly and
that one update doesn't cause multiple updates. I also made sure that
the action method executed on the server is very fast (initially I had
some DRb calls, but now it simply returns a Struct whose properties
are displayed in the view).

Since I'm new to Rails and Ajax, I wanted to know if this is expected,
or if there is something wrong with the way I organized the
periodically_call_remote() code.

Tiberiu Motoc

PS. I'm using WEBrick

Re: periodically_call_remote & WEBrick poor performance

It's just doing normal requests to the server, no magic going on.

Make sure you use eager loading where that's needed, to speed up database queries. And is this on the production server, running in production mode? Don't expect script/server to have uber performance in development mode.

Re: periodically_call_remote & WEBrick poor performance


I am using eager loading in my code, but it's not a problem of object loading. In my action handler I simply create and return a dummy Struct instead of making any other (expensive) method calls.
So I have "@myobj =, :last_name).new('John', 'Doe')" instead of "@myobj = People.find_all".
The server is running in development mode on WEBrick (no Apache, no FastCGI).

Thanks for the reply,