Chapter 4. Web Performance Tester

So far, the programs we've written have been useful, but they've shared one main limitation — they are largely self contained, intended to be run on a single computer (although the database program could certainly have a database housed on another computer). Our next program will change that.

The Web Performance Tester has two main functions (I use "function" in the generic sense here):

  • It will use Python's urllib2 module to emulate a web browser, access several well-known web sites, and report the amount of time it took to get back the HTML from the page accessed. It will also write its results to a log file, which can be accessed later.

  • It will communicate with a simple Python web server on another machine on the computer's internal network, download a text file and a binary file (through HTTP), and report the results. It will record the results in a logfile.

Get Python® Create-Modify-Reuse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.