I just did some simple load tests on a web app I am working on. I was
using apache bench (ab -n 1000 -c 100) and getting results that were
much slower than expected. The Requests/Second were ~ 26. For
comparison I did the same test against the welcome app and I was
getting ~ 59 Requests/Second (with no optimizations).
I started testing various scenarios to determine what was causing the
big discrepancy. I tried all the suggested tips for improving
performance (migrate=False, compile app, cache, session.forget() etc),
with very small improvements...
I was curious what kind of overhead adding tables to the welcome app
would have. To get a good starting point I decided to optimize the
page I was testing in the web app as follows:
#default.py
@cache(request.env.path_info, time_expire=60, cache_model=cache.ram)
def index():
session.forget(response)
return response.render(dict())
After this change I was getting 93 Requests/Second
I added the following table:
db.define_table('table1',
Field('col1','string'),
Field('col2','string'),
Field('col3','string'),
Field('col4','string'),
Field('col5','string'),
Field('col6','string'),
Field('col7','string'),
Field('col8','string'),
Field('col9','string'),
Field('col10','string')
)
and tested again resulting in 87 Requests/Second
I repeated adding tables (table2, table3 etc)
After adding 5 tables the test was down to 67 Requests/Second
After adding 10 tables the test was down to 52 Requests/Second
After adding 30 tables the test was down to 27 Requests/Second
The full test results are logged here:
https://docs.google.com/spreadsheet/ccc?key=0ApWaSSISueScdG1DSDl4NVNkQkQwUVlPZnNBVF9vbmc
I am starting to look at the DAL code to see if I notice anything that
can be improved, haven't noticed anything yet. I am wondering if
anyone has any thoughts on what would be causing this.