SOAP for large datasets

I’ve been playing around with a soap interface to an application that
can return large datasets (up to 50mb or so). There are also some
nested structures for which I’ve used ActionWebService::Struct with
2-3 nested members of oher ActionWebService::Struct members. In
addition to chewing up a ton of memory, cpu ulilization isn’t that
great either. My development server is a dell 2600 Xeon 1.8mghz.
It seems like creating all of the nested structures might be what’s
eating all the cpu. Cpu utilitzation goes up to almost 70%.

A simpler application where I just use plain xml in the request and
response, and use a bit of to_xml and REXML for building the trees
still takes a good amount of memory but nowhere near the amount of
cpu.

The data is from 3 tables. Customers, transactions, and orderitems.
I created a struct for customers and in customers there are two
members that contain a struct for transactions and orderitems.

Right now the code looks like this. Any ideas on how to optimize it?
Or even ideas on better methods then using soap for something like
this?

@orders = Customer.find(:all, :include => [:orderitems, :histories],
:conditions => [“history.trans_date between ? and ?”,start_date,end_d
ate], :limit => 500)

for order in @orders

  oi = []
  for items in order.orderitems
    oi <<  OrderitemData.new(:sku => items.sku, :item_type =>

items.item_type, :descript => items.descript, :amount => items.amount,
:quan
t => items.quant, :trans_id => items.trans_id, :trans_date =>
items.trans_date)
end

  trans = []
  for history in order.histories
    trans <<  TransactionData.new(:sale_type => history.sale_type,

:order_id => order.order_id, :trans_id => history.trans_id, :outcome
=>
history.outcome)
end

  ar <<  CustomerData.new(:orderitem_data => oi, :transaction_data

=> trans, :address => order.address, :address2 => order.address2,
:f_na
me1 => order.f_name1, :l_name1 => order.l_name1)
end
ar
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs