New Relic Python Kata

Code Kata is a term coined by Dave Thomas, co-author of the book The Pragmatic Programmer, in a nod to the Japanese concept of kata in the martial arts. A code kata is an exercise in programming which helps a programmer hone their skills through practice and repetition.

The goal of this Kata is to get your mind wired into performance driven development, to reinforce your skills as a user of New Relic.

Of course the code in some areas of this application is intentionally bad, but what fun would this be if everything worked the way it should?

Sign Up for New Relic »

Step 1

Get the code. Using your github account, fork the newrelic-python-kata repo and then clone it onto your machine.

Fork & Clone! »

Step 2

Create a virtualenv and install the dependencies.

$ cd newrelic-python-kata
$ python venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Step 3

Install Newrelic agent.

$ pip install newrelic

Get the license key from the right side-bar on this page and generate the config file.

$ newrelic-admin generate-config <license> newrelic.ini

Edit the file to suit your needs. (Set transaction_tracer.transaction_threshold to 0.2)

Set the NEW_RELIC_CONFIG_FILE environment variable.

$ export NEW_RELIC_CONFIG_FILE=newrelic.ini

Step 4

Initialize the database.

$ python

Deploy the app.

$ newrelic-admin run-python run_gunicorn

Step 5

Fix the code / Solve as many of the Katas as you can. There are four distinct Katas in this application (check the top bar) each with some hints on their respective pages.

  1. Access your application http://localhost:8000
  2. Generate traffic a.k.a. click around.
  3. Discover a slow page.
  4. Investigate the problem.
  5. Resolve with code changes.
  6. Re-deploy.

Step 6

Let us know how you did, what you liked or disliked, what helped you find problems or what were the challenges, what you like about New Relic and what you don't - we just want to hear from you and see what we can do to get better.

We'll even send you something for demonstrating your geek super powers when you complete the Kata - just provide us with your thoughts and a link to your forked repo (with your answers).

Tell us! »