Skip to content

Commit

Permalink
Add keepalive support to benchmark, add other command-line args
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarnell committed May 15, 2011
1 parent 3205b36 commit a287c20
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions demos/benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@


define("port", type=int, default=8888)
define("n", type=int, default=10000)
define("c", type=int, default=25)
define("keepalive", type=bool, default=False)

class RootHandler(RequestHandler):
def get(self):
Expand All @@ -36,9 +39,13 @@ def main():
app = Application([("/", RootHandler)])
app.listen(options.port)
signal.signal(signal.SIGCHLD, handle_sigchld)
proc = subprocess.Popen(
"ab -n 10000 -c 25 http://127.0.0.1:%d/" % options.port,
shell=True)
args = ["ab"]
args.extend(["-n", str(options.n)])
args.extend(["-c", str(options.c)])
if options.keepalive:
args.append("-k")
args.append("http://127.0.0.1:%d/" % options.port)
proc = subprocess.Popen(args)
IOLoop.instance().start()

if __name__ == '__main__':
Expand Down

0 comments on commit a287c20

Please sign in to comment.