Webrick Development vs. Apache Server Speed

It takes about 40 seconds for my query to the sql server (mysql) to complete.

I would wager that something is wrong with your query.My guess is that you have not taken advantage of eager-loading.

Simple example:

Say a project belongs_to :creator

I want to list all projects.

@projects = Project.find :all

Then I call @project.creator in a loop

@projects.each do |project| project.creator end

That causes one additional db hit for each iteration in the loop.

I should do

@projects = Project.find :all, :include=>[:creator]

That will do a left-join for me, bringing in all projects and creator info into my objects. This is the #1 cause of slow Rails apps in my experience.

The second cause? Failure to properly index the database tables.

Oh, I see now that I was misinterpreting my log file. The query is taking less than one second to execute, and the rednering of the page is taking the rest of the time.

Presumably this is related to the generation of the graph, and some parsing of the data.

So I guess my question now degenerates to how hefty will my server hardware have to be in order to speed up my execution time by about 10x?

Dont' know, but every time this comes up someone says to look into background drb and offload the graph generation to it... then change your app to look to it with a "loading loading loading. done -> show graph" setup.

Might be worth doing here as well...