I wanted to get some general opinions about a particularly cpu-
intensive action I have that generates XML to be fed into a flash-
The data collected for the graph is per-user and is already cached as
much as possible. We use a combination of cache_fu, a 5 minute ttl
fragment cache for the action itself, and model method caching
(partially cache_fu, partially homegrown).
The problem is that when there is a cache miss and the user has a
large amount of data to process, ruby just chugs for a long time..
possibly 30 seconds or even longer (until a mongrel timeout finally
occurs.), so this action is obviously ripe for a refactor.
I decided to replicate the same action as a java class, and achieved a
speedup of roughly 6-7x (5-6 seconds to generate the xml needed as
opposed to about 35 seconds for ruby).
Another idea I had was to create a mysql stored procedure to gather
all the data needed, which can then be synthesized into xml on the
ruby side (this may be preferable since I won't have to introduce java
into our production mix.
I welcome any thoughts/ideas!