??python????????????????????(3)
???????????? ???????[ 2014/1/6 13:56:35 ] ??????????????? python
???????????ж??????????????????????????????????????????????????????????????????????????????????????????????
????????3?? ????????
??????????????????????????python GIL?? ????????????Щ??????python GIL??????????????е??????????????????????????????????????????????????????????????????????д??????????????????????????????????CPU????????????????Linux?????top?????????us ????CPU??????sy????CPU????CPU???????????????????????????????????????????
import threading
class MultipleThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
while 1:
print "here"
for i in xrange(100):
multiple_thread=MultipleThread()
multiple_thread.start()
multiple_thread.join()
??????????GIL??????????????????????????????????Ч???????????????3-4??????????????????????????????2-3???????????????????????????????
???????????????????
?????????????????????????????????????????decode?? encode??????????????????????????????????????????????????????Queue???multiprocessing.Queue()??????????е?DiameterMsgParser(threading.Thread)???DiameterMsgParser(multiprocessing.Process)???и?????鷳????log???????python?????logging???????????д????????????????????????浥???????
import multiprocessing
import logging
class Worker(multiprocessing.Process):
def __init__(self??mp_name??input_queue):
multiprocessing.Process.__init__(self??name=mp_name)
self.input_queue=input_queue
def run(self):
for i in xrange(100):
self.input_queue.put_nowait(i)
logging.debug("test "+str(i))
??????????????????sunfire 4170 (16 core ?? 2.4G ) ????????5000 meesages (???)?? CPU????? 30-40%???????????python2.7???????solaris?????????pypy???????????????????в???pypy????????????????????2???linux?????????python?? pypy?????????????μ?Ч???pypy??Ч?????????д??????????????????? ??????CPU????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11