I work on a benchmark between pymongo and rethinkdb, to compare the time took for insertions.
However this is what I found :
for one-by-one insertions.
def chronometre_rethink_insert_one(data, nblines):
avant = time()
for i in data[:nblines]:
r.table('test_table').insert(dict(zip(names, i))).run()
return time()-avant
def chronometre_mongo_insert_one(data, nblines):
avant = time()
for i in data[:nblines]:
db.test_table.insert_one(dict(zip(names, i)))
return time()-avant
I think that the fact that takes mongo is nearly constant is weird. So I wonder maybe pymongo doesn't insert the data whenever I insert it, but rethinkdb yes, as I call run() on all operations ?
If so, how should I have comparable results ?
It's turn out that I can manage it doing :
client = MongoClient(port=27017, fsync=True)
(adding the fsync), as it "Force the database to fsync all files before returning" (https://api.mongodb.com/python/2.0/api/pymongo/connection.html).
This done, I have result that makes more sense: