Add randomness to workload.
authorFabien Ninoles <fabien@tzone.org>
Sun, 08 May 2011 23:03:00 -0400
changeset 5 55f26e7ee45e
parent 4 4b5a51cb5fc7
child 6 fdf7da5a5d21
Add randomness to workload.
collector.py
--- a/collector.py	Sun May 08 22:58:56 2011 -0400
+++ b/collector.py	Sun May 08 23:03:00 2011 -0400
@@ -113,7 +113,7 @@
         if failure_rate and random.randrange(failure_rate) == 0:
             info("worker failed")
             return False
-        time.sleep(workload)
+        time.sleep(workload * (1 + random.random()))
         debug("worker send reply")
         socket.send_multipart(address + [request[1], "DONE"])
 
@@ -174,7 +174,7 @@
     workers = []
     for url in proxy_urls:
         for work in xrange(5):
-            work = threading.Thread(target = connect_worker, args = (url, 1, 4500))
+            work = threading.Thread(target = connect_worker, args = (url, 1, 4800))
             work.start()
             workers.append(work)
     time.sleep(20)