[Rails] SOAP responses blowing up memory usage

Jon Gubman
Fri, 30 Jun 2006 00:26:07 -0000

Hi,

in our application we have a ActionWebController method that iterates
over a bunch of AR objects (say ~30,000) and converts them to struts.
The controller method automagically converts the array of Struts to
SOAP objects as advertised. There''s a point in
ActionWebService::Dispatcher::ActionController::InstanceMethods#dispatch
_web_service_request (file action_web_service/dispatcher/
action_controller_dispatcher.rb), where memory usage absolutely blows
up when passed large arrays. Monitoring top, it looks like the app
will grow to around 50mb and then when it does the
InstanceMethods#web_service_create_response action memory will shoot
up 5x to ~250mb, which is starting to kill our production servers
(doesn''t take many of these requests to thrash the machine).

Digging into it, it looks like the memory starts to explode around
the call in SOAP::Mapping#obj2soap(obj, @registry), where SOAP goes
through the various Registry factories.

Anyone have any experience w/ this and/or any hints to help lower
memory usage?