I am trying to create a simple web app using Python on GAE. The app needs to spawn some threads per request received. For this I am using python's threading library. I spawn all the threads and then wait on them.
t1.start()
t2.start()
t3.start()
t1.join()
t2.join()
t3.join()
The application runs fine except for the fact that the threads are running serially rather than concurrently(confirmed this by printing the timestamps at the beginning/end of each thread's run() method). I have followed the instructions given in http://code.google.com/appengine/docs/python/python27/using27.html#Multithreading to enable multithreading
My app.yaml looks like:
application: myapp
version: 1
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /stylesheet
static_dir: stylesheet
- url: /javascript
static_dir: javascript
- url: /pages
static_dir: pages
- url: .*
script: main.app
I made sure that my local GoogleAppLauncher uses python 2.7 by setting the path explicitly in the preferences.
My threads have an average run-time of 2-3 seconds in which they make a url open call and do some processing on the result.
Am I doing something wrong, or missing some configuration to enable multithreading?