MongoEngine support connect to multi mongodb databases.
I write this simple code that make 100 connections to mongodb from python script
But, I noticed in the top
, Python cause a very high CPU usage
My CPU:
Why this ?
And If i wanna connect to multi mongodb database in python, How to do it correctly ?
I wrote an equivalent script using pymongo, and the DB CPU usage stayed at 0 even with 300+ connections open.
from pymongo import MongoClient
for x in xrange(100):
MongoClient()
Try it out and see if the problem persists? I believe that it's the officially supported Python package for MongoDB.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.