Comparison of rails and java for mysql

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.

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

Mikkel B. 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 :frowning:

but if in the real life if the insert is quite haeavy, then is that any
way to fix the performance issue ?

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

Frederick C. 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

Fred

I think probably yes…my intend is to load/initialize database before
the application start.

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 :slight_smile:

Is this fast enough for you ?

BTW, are you a fellow Malaysian ?

On Oct 5, 6:07 pm, Ghee wooi Ong [email protected]

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 ?

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 :slight_smile:

Is this fast enough for you ?

BTW, are you a fellow Malaysian ?

On Oct 5, 6:07 pm, Ghee wooi Ong [email protected]

Hi Ghee Wooi

Yes, I am a fellow Malaysian !

CCH wrote:

Hi Ghee Wooi

Yes, I am a fellow Malaysian !

weird…how u know i from Malaysia u know me ??

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs