I have a significantly more performant solution that I am trying. I moved my db.define_table() out of models folder and into a class defined in modules. The class has properties for each table. The properties(tables) are lazy loaded as needed. The way I implemented it, the dal syntax is almost identical when doing selects/inserts/ updates. Here is a gist https://gist.github.com/1796274 now most of my pages test at 60-100 Requests/Second instead of ~25 Requests/Second.
On Jan 7, 7:44 pm, "James M." <sipajah...@gmail.com> wrote: > 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 ofoverheadadding 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=0ApWaSSISueScdG1DSDl4NVNk... > > 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.