您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 盘锦分类信息网,免费分类信息发布

MongoDB性能测试与Python测试代码

2024/10/19 23:59:31发布8次查看
下面是对mongodb测试的代码和结果。虽然公司用的一水的centos,但是由于我是freebsd的支持者,所以在freebsd和centos上都测试了一
#!/usr/bin/env python
from pymongo import connection
import time,datetime
connection = connection('127.0.0.1', 27017)
db = connection['hawaii']
def func_time(func):
        def _wrapper(*args,**kwargs):
                start = time.time()
                func(*args,**kwargs)
                print func.__name__,'run:',time.time()-start
        return _wrapper
@func_time
def remove():
        posts = db.userinfo
        print 'count before remove:',posts.count();
        posts.remove({});
        print 'count after remove:',posts.count();
if __name__ == __main__:
        remove()

盘锦分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录