Friday, October 16, 2009

mongoDB rocks



I have found this project very useful for big sites and heavy load.

mongodb, comparision.
vim ./test_load.py
======================================
#!/usr/bin/env python
from pymongo.connection import Connection

connection = Connection("localhost", 27017)
db = connection["test"]
for collection in db.collection_names():
print collection

collection = db["testCollection"]

for i in range(10000):
collection.insert({"i":i, "body": 'a - %s'%(i,)})
======================================
$time ./test_load.py
real 0m5.301s
user 0m4.160s
sys 0m0.230s
$du -hs /data/db/
81M /data/db/

No comments:

Post a Comment