substantial increase in page load time after upgrade to web2py 2.14.6 (only for grid pages)

59 views
Skip to first unread message

Gaurav Vichare

unread,
Dec 9, 2016, 11:52:10 PM12/9/16
to web2py-users
I did following steps to upgrade:

1. From admin panel, I cleaned, caches, sessions and errors using "clean". (also cleaned my browser cache and cookies)
2. Then created w2p package using "pack all"
3. Downloaded latest web2py 2.14.6 from http://web2py.com/init/default/download
4. Then installed w2p package on web2py 2.14.6 using admin panel
5. Copied web2py.js, appadmin.py, appadmin.html, jquery.js, web2py_ajax.html, web2py.css from welcome app and pasted in newly installed app
6. Made few css changes to match old UI
Now my complete app is running without any python or js errors.

Now when I visit application page containing web2py grid (SQLFORM.grid()) on web2py 2.14.6, it takes 34.775 seconds and on version 2.3.2 same page with same number of records it takes 0.686 seconds. Grid has around 4600 records. Pages that doesn't have grid, took approx same time to load on both versions.


I did time profiling and found that gluon/html.py is taking most of the time.

Time profiling results

2.3.2 : https://paste.ubuntu.com/23602259/

2.14.6 : https://paste.ubuntu.com/23602261/


Also I added print statement before and after grid definition, It took 18 seconds on 2.14.6 and 10 miliseconds on 2.3.2.

SQLFORM.grid() definition is similar to following:

grid = SQLFORM.grid(query,
        create=True,
        csv=False, deletable=False, searchable=search_query,
        showbuttontext=False, links=links, links_placement='left',
        maxtextlengths=textlengths, upload=URL('download'),
        fields=[db.notice.UIN, db.notice.classname, db.notice.title,
                db.notice.type,
                db.notice.description,
                db.notice.due_date, db.notice.status,
                db.notice.risk, db.notice.consequence,
                db.notice.document,
                db.notice.other])


sample query in above grid-

((((user_notice.notice = notice.id) AND (user_notice.auth_user = 19)) AND
  (notice.status IN ('Closed','Open','New'))) AND
 (notice.due_date IS NOT NULL))


I tested this on my local computer- Ubuntu 14.04, Python 2.7.6, development server and mysql db.

Why newer version takes more time to load grid? Anything I missed while doing upgrade?

Please help me to solve this issue.


Thank you

Anthony

unread,
Dec 10, 2016, 4:35:30 PM12/10/16
to web2py-users
Can you post a minimal app that exhibits the same slowdown (maybe add some code using gluon.contrib.populate to generate some dummy data so we can run it with a similar amount of data)?

Gaurav Vichare

unread,
Dec 11, 2016, 3:19:36 AM12/11/16
to web...@googlegroups.com
Thanks Anthony for reply, I will try to reproduce this on dummy app and will post it here.


One more thing, I removed join [ ((user_notice.notice = notice.id) AND (user_notice.auth_user = 19)) ] from query [ ((((user_notice.notice = notice.id) AND (user_notice.auth_user = 19)) AND (notice.status IN ('Closed','Open','New'))) AND (notice.due_date IS NOT NULL)) ] passed to SQLFORM.grid() and checked, It took just 0.1 seconds compare to 18 seconds.
Reply all
Reply to author
Forward
0 new messages