作者:容易 2013-12-17  14:59:55


备注:采用安全写的方式,只会阻塞客户端,并不阻塞服务器端的处理。

平均请求时间Avg_request_time(s):0.000674 单位秒


非安全写  col.insert(dic),只确认数据已经发送到了mongodb服务器端,不等的响应直接返回进行下一次操作。

[mdb@mdb-167 scp]$ python single_load_mongodb_scp.py

Start Time:2013-12-17:10-50-10

start_analyse_time:2013-12-17:10-50-37

Total Request:40 Complete Request:167556 Fail Request:0 Complete_pre:418890.00 total_elapsed_time:15.7695155

Min_request_time(s):0.0000629 Max_request_time(s):0.045730 Avg_request_time(s):0.000094

Request Time Statistics Percentile

0.000094: 95.5829693

0.011503: 99.9659815

0.022912: 99.9725465

0.034321: 99.9898541

end_analyse_time:2013-12-17:10-50-37

run_time:26.54

end_time:2013-12-17:10-50-37


开启安全写  col.insert(dic,safe=True)  该操作只是将请求发送到了mongodb服务器,并且等待mongodb插入成功与否的响应,数据已经存入到mongodb的journal日志缓存,并未真正写入journal日志。

当出现断电时,可能会出现数据丢失。

[mdb@mdb-167 scp]$ python single_load_mongodb_scp.py

Start Time:2013-12-17:10-51-10

start_analyse_time:2013-12-17:10-53-16

Total Request:40 Complete Request:167556 Fail Request:0 Complete_pre:418890.00 total_elapsed_time:112.9517179

Min_request_time(s):0.0003400 Max_request_time(s):0.198021 Avg_request_time(s):0.000674

Request Time Statistics Percentile

0.000674: 95.7381413

0.050011: 99.9952255

0.099348: 99.9976127

0.148684: 99.9994032

end_analyse_time:2013-12-17:10-53-16

run_time:126.04

end_time:2013-12-17:10-53-16


开启安全写,最少写入一个服务器  col.insert(dic,safe=True,w=1)

[mdb@mdb-167 scp]$ python single_load_mongodb_scp.py

Start Time:2013-12-17:12-38-11

start_analyse_time:2013-12-17:12-40-01

Total Request:40 Complete Request:167556 Fail Request:0 Complete_pre:418890.00 total_elapsed_time:97.6288505

Min_request_time(s):0.0003340 Max_request_time(s):0.131060 Avg_request_time(s):0.000583

Request Time Statistics Percentile

0.000583: 68.6421256

0.033202: 99.9988064

0.065821: 99.9994032

0.098441: 99.9994032

end_analyse_time:2013-12-17:12-40-01

run_time:110.45

end_time:2013-12-17:12-40-01


开启安全写并且写入journal日志  col.insert(dic,safe=True,j=1)

[mdb@mdb-167 scp]$ python single_load_mongodb_scp.py

Start Time:2013-12-17:10-56-55

start_analyse_time:2013-12-17:12-34-20

Total Request:40 Complete Request:167556 Fail Request:0 Complete_pre:418890.00 total_elapsed_time:5829.9157062

Min_request_time(s):0.0018489 Max_request_time(s):0.209988 Avg_request_time(s):0.034794

Request Time Statistics Percentile

0.034794: 46.7258708

0.078592: 99.9988064

0.122391: 99.9994032

0.166189: 99.9994032

end_analyse_time:2013-12-17:12-34-20

run_time:5845.62

end_time:2013-12-17:12-34-20



One Response


    还没有评论!
1  

Leave your comment

请留下您的姓名(*)

请输入正确的邮箱地址(*)

请输入你的评论(*)


感谢开源 © 2016. All rights reserved.&3Q Open Source&^_^赣ICP备15012863^_^
乐于分享共同进步 KreativeThemes