At first, I think Bottle will handle requests at the same time, so I wrote the test code below:
import json from bottle import Bottle, run, request, response, get, post import time app = Bottle() NUMBERS = 0 @app.get("/test") def test(): id = request.query.get('id', 0) global NUMBERS n = NUMBERS time.sleep(0.2) n += 1 NUMBERS = n return id @app.get("/status") def status(): return json.dumps({"numbers": NUMBERS}) run(app, host='0.0.0.0', port=8000)
Then I use jmeter to query /test url with 10 loop cycles 20 times.
After that, /status gives me {"numbers": 200} , which seems like the bottle is not processing requests at the same time.
I did not get anything?
UPDATE
I did another test, I think it can prove that the bottle processes requests one by one (without concurrency). I slightly modified the test function:
@app.get("/test") def test(): t1 = time.time() time.sleep(5) t2 = time.time() return {"t1": t1, "t2": t2}
And when I access /test twice in the browser, I get:
{ "t2": 1415941221.631711, "t1": 1415941216.631761 } { "t2": 1415941226.643427, "t1": 1415941221.643508 }
source share