python 2.7 - Mongodb with very high CPU rate -


when ran following code , killed immediately(that means abnormally exit), cpu rate of mongodb go extremely high(around 100%):

#-*- encoding:utf-8 -*-  import threading import time  import pymongo  single_conn = pymongo.connection('localhost', 27017)  class simpleexamplethread(threading.thread):     def run(self):         print single_conn['scrapy'].zhaodll.count(), self.getname()         time.sleep(20)  in range(100):     simpleexamplethread().start() 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

virt  res  shr s %cpu %mem    time+  command 696m  35m 6404 s 1181.7  0.1 391:45.31 mongod 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

my mongodb version 2.2.3. when mongodb worked well, ran command "strace -c -p " 1 minute giving following output:

% time     seconds  usecs/call     calls    errors syscall ------ ----------- ----------- --------- --------- ----------------  33.50    0.322951         173      1867           nanosleep  33.19    0.319950         730       438           recvfrom  21.16    0.203969          16     12440           select  12.13    0.116983       19497         6           restart_syscall   0.02    0.000170           2        73           write   0.00    0.000016           0       146           sendto   0.00    0.000007           0        73           lseek   0.00    0.000000           0         2           read   0.00    0.000000           0         3           open   0.00    0.000000           0         3           close   0.00    0.000000           0         2           fstat   0.00    0.000000           0        87           mmap   0.00    0.000000           0         2           munmap   0.00    0.000000           0         1           pwrite   0.00    0.000000           0         3           msync   0.00    0.000000           0        29           mincore   0.00    0.000000           0        73           fdatasync ------ ----------- ----------- --------- --------- ---------------- 100.00    0.964046                 15248           total 

when cpu rate of mongodb went high(around 100%), ran same command giving following output:

% time     seconds  usecs/call     calls    errors syscall ------ ----------- ----------- --------- --------- ----------------  29.12    5.064230        3088      1640           nanosleep  28.83    5.013239       27851       180           recvfrom  22.72    3.950399      658400         6           restart_syscall  19.30    3.356491         327     10268           select   0.02    0.004026          67        60           sendto   0.01    0.001000         333         3           msync   0.00    0.000269           9        30           write   0.00    0.000125           4        30           fdatasync   0.00    0.000031          10         3           open   0.00    0.000000           0         2           read   0.00    0.000000           0         3           close   0.00    0.000000           0         2           fstat   0.00    0.000000           0        30           lseek   0.00    0.000000           0        57           mmap   0.00    0.000000           0         2           munmap   0.00    0.000000           0         1           pwrite   0.00    0.000000           0        14           mincore ------ ----------- ----------- --------- --------- ---------------- 100.00   17.389810                 12331           total 

and if run command "lsof", there many socks description "can't identify protocol". don't know goes wrong. there bugs in mongodb?

thanks!


Comments

Popular posts from this blog

c# - HttpResponseMessage System.InvalidOperationException -

sql - Postgresql error: "failed to find conversion function from unknown to text" -