hi, I had create a sample test to try out rails performance on mysql I had created one rake task to load a 79440 record (almost 3.84MB) into mysql database (innodb) and another is a java version (JDBC), i found that the performance is alomost the same if the table''s engine is Innodb. (slow, is that anyway to improve the performance? ) since the table is only for read, so of cause MYISAM is more suitable. so with the same code, but difference type of engine (now is MYISAM), and the result i get look like this : 14 seconds - java 1 min 8 seconds - ruby on rails - directly execute sql statement. more then 1 minutes - ruby on rails, which create a object, insert value, and obj.save! it, however, i got no patient to finish it, it is pretty slow. all code is run in same machine (window XP, 1.73GHz intel) mysql version 5.0, ruby use "mysql" adapter, java use JDBC adapter. all code is in attachement. pre condition : mysql5 is install, jdbc driver install, java code point to correct database. instructions : create a rails project and unzip the zip file to the lib/tasks directory. download and unzip the sample file to load into same dir too. this sample can get from http://ip-to-country.webhosting.info/downloads/ip-to-country.csv.zip 1) how can I tweak (or should i tweak) the performance of rails ? 2) why the InnoDB is so slow (is that because of transaction overhead ) ? 3) is this a correct way to test performance ? thank for help. kiwi. Attachments: http://www.ruby-forum.com/attachment/557/code.zip -- 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 -~----------~----~----~----~------~----~------~--~---
Ghee wooi Ong wrote:> 1) how can I tweak (or should i tweak) the performance of rails ? > 2) why the InnoDB is so slow (is that because of transaction overhead ) > ? > 3) is this a correct way to test performance ? > > thank for help. > kiwi.1. no you shouldnt 2. dont know 3. well if thats what your using are doing (importing 8000 reorcrds in a db), then yeah...speed of development/maintenance is more important than speed of db inserts Mikkel -- 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 -~----------~----~----~----~------~----~------~--~---
Mikkel Bruun wrote:> 1. no you shouldnt > 2. dont know > 3. well if thats what your using are doing (importing 8000 reorcrds in a > db), then yeah...speed of development/maintenance is more important than > speed of db inserts > > > Mikkel"more then 1 minutes - ruby on rails, which create a object, insert value, and obj.save! it, however, i got no patient to finish it, it is pretty slow." for test above, i think the code should simply like this (result of 1 min and 8 sec is using SQL directly ). accept the performance is slow. I like the way ruby on rails doing web development, but unfortunately that i more familiar with java, and in fact java for me is more easy to read and code. (accept to many xml files) and ruby i only learn 3 month. hence maintenance of ruby could be my problem too :( but if in the real life if the insert is quite haeavy, then is that any way to fix the performance issue ? -- 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 -~----------~----~----~----~------~----~------~--~---
On 5 Oct 2007, at 11:07, Ghee wooi Ong wrote:> > but if in the real life if the insert is quite haeavy, then is that > any > way to fix the performance issue ?Can you bulk insert stuff - ie write sql to insert more than one record in one go? IIRC there is a plugin (ActiveRecord Extensions) that helps with this Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Ghee Wooi I have a e-CRM apps with more than 200 tables. In particular I have a time-sheet module with more than 40,000 records For me to display a grid, it takes 2-3 seconds and to insert a record into the same table also 2-3 seconds :-) Is this fast enough for you ? BTW, are you a fellow Malaysian ? On Oct 5, 6:07 pm, Ghee wooi Ong <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Mikkel Bruun wrote: > > 1. no you shouldnt > > 2. dont know > > 3. well if thats what your using are doing (importing 8000 reorcrds in a > > db), then yeah...speed of development/maintenance is more important than > > speed of db inserts > > > Mikkel > > "more then 1 minutes - ruby on rails, which create a object, insert > value, and obj.save! it, however, i got no patient to finish it, it is > pretty slow." > > for test above, i think the code should simply like this (result of 1 > min and 8 sec is using SQL directly ). accept the performance is slow. > > I like the way ruby on rails doing web development, but unfortunately > that i more familiar with java, and in fact java for me is more easy to > read and code. (accept to many xml files) and ruby i only learn 3 month. > > hence maintenance of ruby could be my problem too :( > > but if in the real life if the insert is quite haeavy, then is that any > way to fix the performance issue ? > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 5 Oct 2007, at 11:07, Ghee wooi Ong wrote: >> >> but if in the real life if the insert is quite haeavy, then is that >> any >> way to fix the performance issue ? > > Can you bulk insert stuff - ie write sql to insert more than one > record in one go? IIRC there is a plugin (ActiveRecord Extensions) > that helps with this > > FredI think probably yes..my intend is to load/initialize database before the application start. -- 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 -~----------~----~----~----~------~----~------~--~---
CCH wrote:> Hi Ghee Wooi > > I have a e-CRM apps with more than 200 tables. > In particular I have a time-sheet module with more than 40,000 records > > For me to display a grid, it takes 2-3 seconds and to insert a record > into the same table also 2-3 seconds :-) > > Is this fast enough for you ? > > BTW, are you a fellow Malaysian ? > > On Oct 5, 6:07 pm, Ghee wooi Ong <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>hm...I think is fast enough. of coz depend on the intend of the app itself. yes, i''m from malaysia. you also from malaysia ? -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Ghee Wooi Yes, I am a fellow Malaysian !> > yes, i''m from malaysia. you also from malaysia ?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
CCH wrote:> Hi Ghee Wooi > > Yes, I am a fellow Malaysian !weird...how u know i from Malaysia u know me ?? -- 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 -~----------~----~----~----~------~----~------~--~---