[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server - MaxSockets.py:1.1.2.1 Adjustments.py:1.1.2.4.2.4
Shane Hathaway
shane@cvs.zope.org
Fri, 5 Apr 2002 17:46:04 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Server
In directory cvs.zope.org:/tmp/cvs-serv18521
Modified Files:
Tag: Zope3-Server-Branch
Adjustments.py
Added Files:
Tag: Zope3-Server-Branch
MaxSockets.py
Log Message:
Added a copy_bytes adjustment and moved MaxSockets out of the tests subdir, removing the copyright declaration since we might not own the copyright.
=== Added File Zope3/lib/python/Zope/Server/MaxSockets.py ===
# Medusa max_sockets module.
import socket
import select
# several factors here we might want to test:
# 1) max we can create
# 2) max we can bind
# 3) max we can listen on
# 4) max we can connect
def max_server_sockets():
sl = []
while 1:
try:
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.bind (('',0))
s.listen(5)
sl.append (s)
except:
break
num = len(sl)
for s in sl:
s.close()
del sl
return num
def max_client_sockets():
# make a server socket
server = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
server.bind (('', 9999))
server.listen (5)
sl = []
while 1:
try:
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.connect (('', 9999))
conn, addr = server.accept()
sl.append ((s,conn))
except:
break
num = len(sl)
for s,c in sl:
s.close()
c.close()
del sl
return num
def max_select_sockets():
sl = []
while 1:
try:
num = len(sl)
for i in range(1 + len(sl) * 0.05):
# Increase exponentially.
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
s.bind (('',0))
s.listen(5)
sl.append (s)
select.select(sl,[],[],0)
except:
break
for s in sl:
s.close()
del sl
return num
=== Zope3/lib/python/Zope/Server/Adjustments.py 1.1.2.4.2.3 => 1.1.2.4.2.4 ===
# FOR A PARTICULAR PURPOSE.
-from tests import MaxSockets
+import MaxSockets
class Adjustments:
@@ -21,6 +21,9 @@
# send_bytes is the number of bytes to send to socket.send().
send_bytes = 8192
+ # copy_bytes is the number of bytes to copy from one file to another.
+ copy_bytes = 65536
+
# Create a tempfile if the pending output data gets larger
# than outbuf_overflow. With RAM so cheap, this probably
# ought to be set to the 16-32 MB range (circa 2001) for
@@ -41,7 +44,7 @@
# Maximum seconds to leave an inactive connection open.
channel_timeout = 900
- # Boolean: turn off to ignore premature client disconnects.
+ # Boolean: turn off to not log premature client disconnects.
log_socket_errors = 1