|
[Webware-checkins] CVS: Webware/WebKit ThreadedAppServer.py,1.52,1.53
From: Jay Love <jslove@us...> - 2002-01-26 16:42
|
Update of /cvsroot/webware/Webware/WebKit In directory usw-pr-cvs1:/tmp/cvs-serv15494 Modified Files: ThreadedAppServer.py Log Message: Apply patch from Ken Lalonde to improve dynamic thread creation. Index: ThreadedAppServer.py =================================================================== RCS file: /cvsroot/webware/Webware/WebKit/ThreadedAppServer.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** ThreadedAppServer.py 2001/12/22 07:45:14 1.52 --- ThreadedAppServer.py 2002/01/26 16:42:51 1.53 *************** *** 160,164 **** if threadCheck > threadCheckInterval: ! if debug: print "Busy Threads: ", self.activeThreadCount() threadCheck=0 self.manageThreadCount() --- 160,164 ---- if threadCheck > threadCheckInterval: ! if debug: print "\nBusy Threads: ", self.activeThreadCount() threadCheck=0 self.manageThreadCount() *************** *** 204,214 **** if debug: print "ThreadCount: ", self.threadCount ! if avg==0: return #we have no observations to use margin = self.threadCount / 4 #smoothing factor if debug: print "margin=", margin ! if avg == self.threadCount and self.threadCount < self.maxServerThreads: ! self.spawnThread() elif avg < self.threadCount - margin and self.threadCount > self.minServerThreads: self.absorbThread() --- 204,217 ---- if debug: print "ThreadCount: ", self.threadCount ! if len(self.threadUseCounter) < 10: return #we have no observations to use margin = self.threadCount / 4 #smoothing factor if debug: print "margin=", margin ! if avg > self.threadCount - margin and self.threadCount < self.maxServerThreads: ! # Running low: double thread count ! n = min(self.threadCount, self.maxServerThreads-self.threadCount) ! for i in range(n): ! self.spawnThread() elif avg < self.threadCount - margin and self.threadCount > self.minServerThreads: self.absorbThread() *************** *** 227,235 **** if debug: print "Absorbing Thread" self.requestQueue.put(None) - self.threadCount = self.threadCount-1 for i in self.threadPool: if not i.isAlive(): rv=i.join() #Don't need a timeout, it isn't alive self.threadPool.remove(i) if debug: print "Thread Absorbed, threadCount=", self.threadCount self.threadUseCounter=[] --- 230,238 ---- if debug: print "Absorbing Thread" self.requestQueue.put(None) for i in self.threadPool: if not i.isAlive(): rv=i.join() #Don't need a timeout, it isn't alive self.threadPool.remove(i) + self.threadCount = self.threadCount-1 if debug: print "Thread Absorbed, threadCount=", self.threadCount self.threadUseCounter=[] *************** *** 585,589 **** def shutDown(arg1,arg2): global server ! print "Shutdown Called" if server: server.initiateShutdown() --- 588,592 ---- def shutDown(arg1,arg2): global server ! print "Shutdown Called", time.asctime(time.localtime(time.time())) if server: server.initiateShutdown() |
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] CVS: Webware/WebKit ThreadedAppServer.py,1.52,1.53 | Jay Love <jslove@us...> |