I''m prototyping a web app in RoR on my desktop machine (1.4ghz, 2gb ram) using webrick and mysql. My application deals with a lot of data for some of our engineers to kind of cherry pick and filter, and then use to publish graphs. So I''m dealing with about 12,000 data points per graph. It takes about 40 seconds for my query to the sql server (mysql) to complete. Will switching from webrick to apache affect the speed of the query, assuming no hardware change? Also, somewhat off topic, but can anyone ballpark for me the kind of hardware I''d need on a server (running apache/mysql, presumably fascgi (although I don''t know if that really matters)) to cut the query time down to ~4 seconds? I know these are vague questions, and I''m just looking for ballpark answers to help make a feasibility judgement. Thanks, James -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
James, More than likely your query time is based on a lack of indexes. You may want to check to ensure that your database isn''t actually slowing you down instead of the rendering of your graph. Switching web servers will not help the speed of your query. You need to look at your datamodel and your indexing. Carl On 12/14/06, James <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m prototyping a web app in RoR on my desktop machine > (1.4ghz, 2gb ram) using webrick and mysql. > > My application deals with a lot of data for some of our engineers to > kind of cherry pick and filter, and then use to publish graphs. > So I''m dealing with about 12,000 data points per graph. > > It takes about 40 seconds for my query to the sql server (mysql) to > complete. > > Will switching from webrick to apache affect the speed of the query, > assuming no hardware change? > > Also, somewhat off topic, but can anyone ballpark for me the kind of > hardware I''d need on a server (running apache/mysql, presumably fascgi > (although I don''t know if that really matters)) to cut the query time > down to ~4 seconds? > > I know these are vague questions, and I''m just looking for ballpark > answers to help make a feasibility judgement. > > Thanks, > James > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> 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. On 12/14/06, James <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > I''m prototyping a web app in RoR on my desktop machine > (1.4ghz, 2gb ram) using webrick and mysql. > > My application deals with a lot of data for some of our engineers to > kind of cherry pick and filter, and then use to publish graphs. > So I''m dealing with about 12,000 data points per graph. > > It takes about 40 seconds for my query to the sql server (mysql) to > complete. > > Will switching from webrick to apache affect the speed of the query, > assuming no hardware change? > > Also, somewhat off topic, but can anyone ballpark for me the kind of > hardware I''d need on a server (running apache/mysql, presumably fascgi > (although I don''t know if that really matters)) to cut the query time > down to ~4 seconds? > > I know these are vague questions, and I''m just looking for ballpark > answers to help make a feasibility judgement. > > Thanks, > James > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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? PS Thanks Brian for your example, while this wasn''t the issue with my current application, I was doing what you pointed out in some of my other projects that I worked on at home while learning rails :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> 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... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---