Search code examples
mongodbstress-testingtsungtokumx

Tokumx VS mongodb read performance


I was doing a read performance stress testing by comparing Tokumx and pure Mongodb.

Both tokumx and mongodb were running in the same machine.

Hardware Overview:

Model Name: Mac mini
Model Identifier: Macmini6,1
Processor Name: Intel Core i5
Processor Speed: 2.5 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache (per Core): 256 KB
L3 Cache: 3 MB
Memory: 10 GB

There are only one collection in each instance. There are 100,000 entries in each collection.

For tokumx, it was created as partitioned collection. But for mongodb, it was created as a normal collection:

db.createCollection("sample", {partitioned: true, primaryKey:  {field1:1, _id: 1}});

And for both instance the index looks like following:

db.sample.ensureIndex({field1:1});
db.sample.ensureIndex({field2:1});
db.sample.ensureIndex({field3:1});
db.sample.ensureIndex({field4:1});
db.sample.ensureIndex({geo:"2d"});
db.sample.ensureIndex({"created_at":1});

I was using Tsung to do the stress testing. In test plan, I did a simple search by looking field2 and geo fields order by created_at desc.

<clients>
<client host="localhost" use_controller_vm="false" maxusers="8000"/>
</clients>
<servers>
<server host="jchimac.thenetcircle.lab" port="8080" type="tcp"/>
</servers>
<load duration="5" unit="minute">
<arrivalphase phase="1" duration="5" unit="minute">
<users interarrival="0.03" unit="second"/>
</arrivalphase>
</load>

According to official document, the transaction should be like TOKUMX™ BENCHMARK VS. MONGODB – HDD

enter image description here

But in my testing:

TOKUMX:

enter image description here

enter image description here

MongoDB:

enter image description here

enter image description here

I am asking here to know is anyone can give any hint about this? Did I miss something in the whole testing?


Updates:

I did another round testing on Linux(CentOS) machine:

CentOS release 6.5 (Final)
2.6.32-504.1.3.el6.x86_64 GNU/Linux
MemTotal:       24589896 kB
CPU: 12* (Intel(R) Xeon(R) CPU E5645  @ 2.40GHz)

Sample Data looks like:

{
  "_id": ObjectId("54867dc8ffbc15aa2bc3ee0e"),
  "_iid": 15,
  "_pid": 15,
  "uid": 102296,
  "nickname": "nickname_102296",
  "gender": 3,
  "image_id": 15,
  "created_at": 1418100168,
  "tag": 1,
  "geo": {
    "lat": 51.590449999999997033,
    "lon": 6.9671900000000004383
  }
}

Each collection has 1,000,000 entries.

Indices on each collection(Normal collections are created):

db.createCollection("coll", {primaryKey:  {_pid:1, _id: 1}});
db.tokumx_coll.ensureIndex({gender:1}); 
db.tokumx_coll.ensureIndex({uid:1}); 
db.tokumx_coll.ensureIndex({geo:"2d"}); 
db.tokumx_coll.ensureIndex({_pid:1}); 
db.tokumx_coll.ensureIndex({_iid:1}); 
db.tokumx_coll.ensureIndex({"created_at":1}); 

Test plan is also quite simple:

{'$query', {gender,3,geo, {'$geoWithin', {'$center', [[48.72761, 9.24596], 0.005]}}}, '$orderby',{'_pid',-1}} 

Tsung stress testing running for 1 hour for each testing. And the concurrency is 1 request per second.

  <load>
    <arrivalphase phase="1" duration="60" unit="minute">
      <users interarrival="1" unit="second"/>
    </arrivalphase>
  </load>

Here is the report in screenshot:

TOKUMX:

tokumx summary
tokumx reports

MONGODB:

mongodb summary mongodb reports


Updates @2014.12.12 Found this: https://github.com/Tokutek/mongo/issues/1014


Solution

  • TokuMX 2.0.0 Community Edition for MongoDB is still built on MongoDB 2.4 which doesn't have GEO 2dsphere index yet when I made this post. So if you are making a Compound Indexes having GEO index, you have to wait for the version base on MongoDB 2.6 which support geo 2dshere index.

    Basically:

    • "2d indexes": Compound indexes with only one additional field, as a suffix of the 2d index field
    • "2dsphere indexes": Compound indexes with scalar index fields (i.e. ascending or descending) as a prefix or suffix of the 2dsphere index field

    And if you are interested in more my stress testing, you can find it in this post.