« My top n tips for python coding in Optimisation | Main | Auckland NZPUG presentation »
Monday
Jan232012

Quick note about stress testing on Google Appengine

In a follow up to my last post on GAE I have the following script that hammers a GAE application to make sure it does not fail under load. Note the following:

  1. Change the url for the endpoint to your app.
  2. Change the test to be appropriate for what should be returned from your app.
  3. The test endpoint should be unique (see the fake query string) or google will cache the results and your app will only see about two requests a second.
"""
Stress tests a endpoint for a GAE application
"""
# rate is in requests per second
rate = 5
# test time is in seconds
test_time = 120
# url to hit has to be unique so that the request hits 
# the app not the cache
url = 'http://your-app.appspot.com/endpoint?test=%s'

test_string = "This string should be in the html response"

import time
import multiprocessing
import urllib
import random


def test():
    """
    The test function
    """
    url_open = urllib.urlopen(url%random.random())
    if test_string in url_open.read():
        pass
    else:
        print 'Failed'

if __name__ == '__main__':
    processes = []
    start = time.time()
    while time.time() <= start + test_time:
        p = multiprocessing.Process(target=test)
        p.start()
        processes.append(p)
        time.sleep(1.0 / rate)
    for p in processes:
        p.join()
    print 'Tested url %s times' % (test_time * rate)

PrintView Printer Friendly Version

EmailEmail Article to Friend

References (34)

References allow you to track sources for this article, as well as articles that were written in response to this article.
  • Response
    Hello, your articles here Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine to write well, thanks for sharing!
  • Response
    Response: fOetPesF
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: baby g
    seiko 3b51
  • Response
    Where can I find info on how to protect/copyright articles posted on the web?
  • Response
    exercise at least 20 minutes a day can reduce stress
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    see here for best empresa seo anywhere
  • Response
    The best seo valencia around
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: back pain
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: www.amazon.com
    All programming languages have some primitive building blocks for the description of data and the processes or transformations applied to them. These primitives are defined by syntactic and semantic rules which describe their structure and meaning respectively.
  • Response
    Integer programming reports linear programs in which many or almost all issues are generally limited to take on integer values. This is not convex, along with on the whole a lot more hard in comparison with regular linear programming.
  • Response
    Response: buzzfeed.com
    In computer programming, readability refers to the ease with which a human reader can comprehend the purpose, control flow, and operation of source code. It affects the aspects of quality above, including portability, usability and most importantly maintainability.
  • Response
    Response: SEO Sydney
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: D D Photographics
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: chiroractic
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: chiroractic
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: D D Photographics
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: D D Photographics
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: D D Photographics
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: D D Photographics
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: D D Photographics
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: fails 2014
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: hydroponic systems
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: chiroractic
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: chiroractic
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: jeteye.com
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Response: Jordan 5 3Lab5
    In their?, NHC gave this system a 50% Nike Jordan CP3 chance of developing into a tropical depression or tropical Air Jordans 3(III) storm by Wednesday To minimize cost, it helps to know where and how to find the cheapest kites in the worldAre you looking out for golf grips for ...
  • Response
    Stuart Mitchell Consulting - Journal - Quick note about stress testing on Google Appengine
  • Response
    Many online writing services are given good content writing steps and good online writing service steps. These are all more help to me and to all the writers at online writing places.

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>