Hi Ezra,
This is what I find strange. Just to choose one example, I have an edit
product view whose controller action simply finds the product and makes
an instance variable out of it so that the form can be populated (i.e.
it’s not the product update action).
e.g.
@product = Product.find(params[:id])
@song = Song.new
unless @product && @product.sellable
@artists = String.new
@label = Label.new
@genre = Genre.new
@instrument = Instrument.new
@supplier = Supplier.new
else
@artists = @product.sellable.artists.collect {|a| a.name }.join('
, ')
@label = @product.sellable.label.name
@genre = @product.sellable.genre.name
@instrument = @product.sellable.instrument.name
@supplier = @product.supplier.name
end
The view is just a basic form (created from a few partials) utilizing
standard rails form tags to edit the product. It has a small section
specific to the kind of sellable and a section specific to product
details.
I have suspected Rmagick as a possible offender but after further tests
I have rejected it as a possibility. (Images are processed via rmagick
just the once and thereafter they are cached on the browser)
The Product model:
has_one :sellable
belongs_to :supplier #where supplier is sublclassed into Album/Song
(STI)
belongs_to :image
has_many :shopping_items, :dependent => :destroy
has_many :supplier_order_items
belongs_to :user
There’s nothing very complex about this action apart from the fact that
the AR model has a few associations.
I have stress tested this action on my development box (set to
production mode) and it appears rock solid. The fcgi process has a
steady 28Mb during and after a heavy attack (ab -kc 50 -t 300). cpu
levels are similarly non-interesting. valgrind memcheck doesn’t report
anything out of the ordinary
On textdrive though it’s a different story, rss starts of at 32Mb and
rockets up after only a few refreshes of this action (and yes I’m
running the app in production mode), the cpu cycles also increase,
though up until I say the process_watchdog.log I wasn’t that worried
about them.
In short I’m stumped as to why this is behaving so differently on
textdrive and I’m not really sure what I can do to optimize this.
I’d appreciate any advice.
Thanks,
Saimon
Ezra Z. wrote:
On May 18, 2006, at 4:17 AM, Saimon M. wrote:
exceeds 17% average cpu usage in the last few minutes)
what I can do about it?
Posted via http://www.ruby-forum.com/.
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
Dae San H.
[email protected]
Well, what does your app do? What parts of it are processor
intensive? Using RMagick? Some details and we might be able to help you.
-Ezra