Couchdb Vs MySQL insert performance test data of the speed test

Couchdb:

Quote

Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP / JSON API. Among other features, it provides robust, incremental replication with bi-directional conflict detection and resolution, and is queryable and indexable using a table-oriented view engine with JavaScript acting as the default view definition language.

Rest is Couchdb way to complete the operation of the distributed document database, it is necessary to complete the operation Couchdb many words, it is necessary to the implementation of Http requests. Traditional databases are completed through DBAdapter messaging, then can consider: Http request DBAdapter traditional efficiency and the efficiency of the request, to a certain extent affect the Couchdb and traditional database performance.

At Couchdb, the holding insert data for each time a data interpolation, the client must put the request to launch a, Couchdb no longer accept this request and make a deal. Now I do this on a test to compare two Couchdb and Mysql database Insert data speed. Play mysql and couchdb operation initiated from the client, mysql and couchdb loaded simultaneously on a single server. Record through the benchmark time-consuming operation.

Test environment: a server, a client,

server: DELL1950 division of one virtual machine, cpu: 2, mem: 2GB
mysql: Server version: 5.0.67-0ubuntu6 (Ubuntu)
couchdb: Apache CouchDB 0.8.0-incubating (LogLevel = info)
File System:

Filesystem Type Size Used Avail Use% Mounted on
/ dev/sda1 ext3 85G 1.5G 80G 2% /
tmpfs tmpfs 1013M 0 1013M 0% / lib / init / rw
varrun tmpfs 1013M 356K 1012M 1% / var / run
varlock tmpfs 1013M 0 1013M 0% / var / lock
udev tmpfs 1013M 2.6M 1010M 1% / dev
tmpfs tmpfs 1013M 0 1013M 0% / dev / shm

client: ordinary desktop

Test scenario:
1, mysql and insert couchdb the 1000 data, time-consuming.
2, mysql and insert 10000 the couchdb contrast time-consuming data.

Test code is as follows:

require 'rubygems'
require 'couchdb'
require 'active_record'
require 'active_record/vendor/mysql'
require 'pp'

ActiveRecord::Base.establish_connection(
  :adapter=>"mysql",
  :encoding=>"utf8",
  :database=>"couchdbvsmysql",
  :username=>"root",
  :password=>"******",
  :host=>"1.2.3.4")

#A database must be named with all lowercase characters (a-z), digits (0-9), or any of the _$()+-/ characters
#and must end with a slash in the URL. The name has to start with characters.

server = Couch::Server.new("10.2.226.133", "5984")
server.put("/couchdbvsmysql/", "")

seq1=1
seq2=1

print "-----------------------------------------------------------------\n"
print "                  Insert Records                                   \n"
print "-----------------------------------------------------------------\n"

sql=proc {<<SQL
insert into udb_user(user_id,user_name,creator)
values("#{(seq1+=1).round}","user#{(rand*10**10).round}","CuiZheng#{seq1}")
SQL
}


json=proc{<<JSON
{"user_id":"#{seq2+=1}","user_name":"user#{(rand*10**10).round}","creator":"CuiZheng#{seq2}"}
JSON
}

InsertIntoMysql=proc do |x|
  proc do
    x.times{ActiveRecord::Base.connection.execute(sql.call.gsub("\n"," "))}
  end
end

InsertIntoCouchdb=proc do |x|
  proc do
    x.times{server.put("/couchdbvsmysql/#{seq2}",json.call.gsub("\n"," "))}
  end
end

Benchmark.bm(25) do |x|
  x.report("InsertIntoMysql",&(InsertIntoMysql.call(10**4)))
  x.report("InsertIntoCouchdb",&(InsertIntoCouchdb.call(10**4)))
end


Scene 1 (1000 data insert test results):
-----------------------------------------------------------------

                  Insert Records                                   

-----------------------------------------------------------------

                               user     system      total        real

InsertIntoMysql            0.171000   0.062000   0.233000 (  7.297000)

InsertIntoCouchdb          1.922000   1.219000   3.141000 ( 27.969000)


Here we can see, Couchdb indeed Mysql insertion than slower, but much slower, four times the gap.

Scene II (10000 data insert test results):
-----------------------------------------------------------------

                  Insert Records                                   

-----------------------------------------------------------------

                               user     system      total        real

InsertIntoMysql            2.187000   0.547000   2.734000 ( 12.953000)

InsertIntoCouchdb        D:/ruby/lib/ruby/1.8/net/http.rb:560:in `initialize':  Typically each socket address  ( Protocol  / Network address  / Port  ) Allows for only one time.  - connect(2) (Errno::EADDRINUSE)

        from D:/ruby/lib/ruby/1.8/net/http.rb:560:in `open'

        from D:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect'

        from D:/ruby/lib/ruby/1.8/timeout.rb:53:in `timeout'

        from D:/ruby/lib/ruby/1.8/timeout.rb:93:in `timeout'

        from D:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect'

        from D:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start'

        from D:/ruby/lib/ruby/1.8/net/http.rb:542:in `start'

        from D:/ruby/lib/ruby/1.8/net/http.rb:440:in `start'

         ... 7 levels...

        from F:/MySummary/MyRails/RubyApplication1/lib/CouchdbVsMysqlPerf.rb:54

        from D:/ruby/lib/ruby/1.8/benchmark.rb:177:in `benchmark'

        from D:/ruby/lib/ruby/1.8/benchmark.rb:207:in `bm'

        from F:/MySummary/MyRails/RubyApplication1/lib/CouchdbVsMysqlPerf.rb:52


Run a lot of times, will be reported to "usually each socket address (protocol / network address / port) to allow only used once." Anomaly. This is why estimates are requesting a flower for a very long time without the release of the client socket lead, there may be momentary couchdb to deal with, however, I guess.

To explain the benchmark:

lgn21st wrote

benchmark shown in the report information are:
This report shows the user CPU time, system CPU time, the sum of the user and system CPU times, and the elapsed real time. The unit of time is seconds.
And the user cpu time, system time, the user system time together, the actual time-consuming unit is second.

Can be run through the browser's look at the status of couchdb:

Couchdb list of all databases:
http://10.2.226.133:5984/_all_dbs

The browser displays:
[ "couchdbvsmysql"]
Listed in the database couchdbvsmysql state:
http://10.2.226.133:5984/couchdbvsmysql

The browser displays:
( "db_name": "couchdbvsmysql", "doc_count": 1000, "doc_del_count": 0, "update_seq": 1000, "compact_running": false, "disk_size": 2376834)

This is run 1000 data interpolation results.

Through the top of the results of my casual, Couchdb insertion Mysql is indeed slower than slow. As a distributed database, Couchdb first question to be addressed are: adjust the speed of Erlang Http server, do not appear to insert 10,000 data appears to deal with the situation, however (I guess there may be a server in response to long lead), then Couchdb identify a suitable file system (I think a document database to read and write speed of disk and file system should be the type of relationship between the great). The test results are a single Couchdb, and should not have been deployed into a distributed database for comparison, such as high-version Couchdb Supporting distributed again after the test.

Couchdb Vs MySQL insert performance test data of the speed test
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Couchdb Vs MySQL insert performance test data of the speed test

  • Comparison of various Ruby VMs

    At QCon San Francisco, the United States in 2008 a report on the General Assembly, Jason Seifer compares the number of Ruby virtual machine you realize the difference between, and pointed out that enterprises should be how to choose the suitable Ruby ...

  • Various Ruby virtual machine comparison

    At QCon San Francisco, the United States in 2008 a report on the General Assembly, Jason Seifer compares the number of Ruby virtual machine you realize the difference between, and pointed out that enterprises should be how to choose the suitable Ruby ...

  • portal of the SSO to develop documentation

    Writing two days before to see the others, and feeling good on the turn over as a reference Portal portal in order to meet with the various subsystems of the demand for a unified sign, thus the use of CAS for SSO Single Sign-profile development. Deve ...

  • PHPRPC for rails

    I want to use rails agile development, PHPRPC wanted to use the cross-language, cross-platform, cross-environment characteristics. Now that andot have achieved PHPRPC for ruby, why then did I not PHPRPC for rails? Future is bright, the process is dif ...

  • Why do you need to Ruby

    The hardship of this we say that C, and C + + is a group, because they do not have a virtual execution environment, for the real computer environment, C can make C + + to do all the things, but the C demand for large-scale development should not sign ...

  • Will be installed as a Windows Service RedMine, boot automatically

    Earlier used RedMine, Ruby on Rails written by ruby command-line command to start, not very convenient. Because when the system restart after automatic updates, all users will become write-off status, the user-state implementation of the command-line ...

  • ROR environmental configuration (rails2.2.2 fell from 1.2.6)

    ROR environment structures put my steps down - Memo 2009.1.26 ROR online to find some tutorials are ruby 1.8.5, rails1.2.6 to do based on the demonstration I use the version downloaded from the Internet are the latest version at the installation enco ...

  • ruby MBARI large patches Performance Evaluation Report

    Before JavaEye news ruby memory leak culprit - the specter of a detailed analysis of the current pointer Ruby official version (MRI version) causes memory leaks. Brent Roman today issued a Super patch , Which contains 6 patch file to resolve the Ruby ...

  • Using ActiveRecord from Rails

    ActiveRecord is by far the best I have seen the ORM library, apart from DB2, supports all the mainstream databases. If you want to know how to use a separate Activerecord, please follow me. Introduce my system environment: OS: windows2003 DataBase: O ...

  • JUnit Unit Testing Summary

    Read some of the unit test article, from the article in the interception of a number of information, which could be considered in the learning process, a summary of it! See future! Unit testing code is not used to prove you are right, but in order to ...

Leave a Reply

Recent
Recent Entries
Tag Cloud
Random Entries