reintroduced ip_queue_ttl all-memcached
authorTarek Ziade <tarek@ziade.org>
Mon, 20 Dec 2010 15:30:08 +0000
branchall-memcached
changeset 175 69356d6196f04b0ef0a0dec8ec326ae6c7c574fe
parent 174 539bed490038e27c948eb92891e5fade2879beed
push id114
push usertziade@mozilla.com
push dateMon, 10 Jan 2011 09:17:15 +0000
reintroduced ip_queue_ttl
keyexchange/filtering/middleware.py
keyexchange/tests/StressTest.conf
--- a/keyexchange/filtering/middleware.py
+++ b/keyexchange/filtering/middleware.py
@@ -60,17 +60,17 @@ from keyexchange.filtering.ipcounter imp
 
 
 class IPFiltering(object):
     """Filtering IPs
     """
     def __init__(self, app, blacklist_ttl=300, br_blacklist_ttl=86400,
                  treshold=20, br_treshold=5, cache_servers=None,
                  admin_page=None, use_memory=False, observe=False,
-                 callback=None, ip_whitelist=None):
+                 callback=None, ip_whitelist=None, ip_queue_ttl=3600):
 
         """Initializes the middleware.
 
         - app: the wsgi application the middleware wraps
         - blacklist_ttl: defines how long in seconds an IP is blacklisted
         - br_blacklist_ttl: defines how long in seconds an IP that did too many
           bad requests is blacklisted
         - treshold: max number of calls per IP before we blacklist it.
@@ -79,16 +79,17 @@ class IPFiltering(object):
           This mode is useful to observe the behavior of an application without
           rejecting any call, to make sure a configuration works fine. Notice
           that a blacklisted IP will continue to raise its counter in the
           queue.
         - callback: callable that will be called with an IP that is added
           in the blacklist.
         - ip_whitelist: a list of IP that should never be blacklisted.
           Supports all netmask notations.
+        - ip_queue_ttl: time to live for the ip queue
         """
         self.app = app
         self.blacklist_ttl = blacklist_ttl
         self.br_blacklist_ttl = br_blacklist_ttl
         self.treshold = treshold
         self.br_treshold = br_treshold
         self.observe = observe
         self._lock = threading.RLock()
--- a/keyexchange/tests/StressTest.conf
+++ b/keyexchange/tests/StressTest.conf
@@ -47,21 +47,22 @@ sleep_time_max = 0
 
 
 # ------------------------------------------------------------
 # Configuration for bench mode fl-run-bench
 #
 [bench]
 
 # cycles = list of cycles with their number of concurrent users
-cycles = 30
+cycles = 150
+#:200:250
 #:25:50:100:150:200
 
 # duration = duration of a cycle in seconds
-duration = 120
+duration = 30
 
 # startup_delay = time to wait between starting-up threads in seconds
 startup_delay = 0.05
 
 # sleep_time = time to wait between test in seconds
 sleep_time = 0.01
 
 # cycle_time = time to wait between cycle in seconds