O'Reilly logo

Python Testing Cookbook by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recording and playing back live data as fast as possible

Replaying production data as fast as possible (instead of in real time) can give you insight into where your bottlenecks are.

Getting ready

  1. Make sure the MySQL production database server is up and running.
  2. Open a command-line MySQL client shell as the root user.
  3. Create a database for this recipe called recipe65 as well as a user with permission to access it.
  4. Exit the shell.
    Getting ready

How to do it...

In these steps, we will write some code that lets us put a big load on our system.

  1. Write a script called recipe65_livedata.py that simulates live data being sent every one to ten seconds.
    import random import sys ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required