On Tue, Oct 7, 2008 at 5:26 PM, Anthony Ettinger <[EMAIL PROTECTED]> wrote:
>  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+   PPID
> COMMAND
> 12565 ettinger  39   0 1110m 1.1g 2680 R 99.9 54.4  21:53.77     1
> /usr/bin/ruby1.8 /usr/bin/mongrel_rails start -C
> /home/ettinger/directoryofdirect
>
>
>
> CPU: 99.9%
> Mem: 54.4%
>
> What can I do to bring this back inline with an acceptable value?
>
>

After switching hosting providers (as this was the default response I
got from many), the prod app still had the same issue and stopped
serving. Thanks to a couple of people on #rubyonrails channel, we
narrowed it down to a bad circular reference in the :include => [...]
method I was using for the sortable_column_headers plugin.

Here's the change I made, and the app loaded fine after that:

                @directories = Directory.paginate(  :page => params[:page],
-
                            :include => [{ :software => :directories
}, { :status => :directories }],
+
                            :include => [:software, :status],


You may be able to ascertain this by tailing the production.log and
then cutting and pasting the SQL query into the mysql monitor
manually, with the words "EXPLAIN <sql query here>" infront of it.
This could help explain where indexes could be useful, although that
helped it was not my problem.

My next task is to learn how to debug and profile my rails app and how
to copy production data in a test database so these issues surface as
soon as the code is written. For my case, the test database only had a
few rows, so the exponential growth in the query time was able to pass
through with only 5 data sets...on production it was 89 and tail spun
into a memory/cpu hog.


-- 
Anthony Ettinger
408-656-2473
http://anthony.ettinger.name

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Deploying Rails" group.
To post to this group, send email to rubyonrails-deployment@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-deployment?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to