Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27774 closed Uncategorized (invalid)

django admin with many objects count is very slow

Reported by: Sayid Munawar Owned by: nobody
Component: contrib.admin Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes

Description

Django version 1.11a1

i created many (thousands) objects:

...: count = 500
...: for x in range(0, count):
...:     print(Group.objects.create(name=usr()))
marmut_jahat_4230
hamster_harum_1454
...
kertas_bangga_8357
ular_semangat_5998

In [10]: Group.objects.count()
Out[10]: 4265

Then go to Admin->Groups, and click one of them. The page will be rendered very slow compared to django 1.10. See screenshots:

Django 1.10

https://monosnap.com/file/e9MJR67566oxSjQ9E15hTKaut3PnKS.png

Django 1.11a

https://monosnap.com/file/EGA8rgYrETlwkNYnkwImmfIYZtl9IY.png

Django 2.0-dev

https://monosnap.com/file/TXvZ3t7Tu4eZXfA6OslNDer3oGRG2y.png

Change History (6)

comment:1 by Tim Graham, 8 years ago

That might be due to template-based widget rendering (#15667). Can you bisect to find the commit where the behavior changed?

comment:2 by Sayid Munawar, 8 years ago

Hi Tim, i don't know how to write a test for this case. i just using git prev / next around commits in that ticket. And i found this commit

commit b52c73008a9d67e9ddbb841872dc15cdd3d6ee01
Author: Preston Timmons <prestontimmons@gmail.com>
Date:   Tue Dec 27 17:00:56 2016 -0500

    Fixed #15667 -- Added template-based widget rendering.

will make the render slow. on the commit before that (51cde87... Fixed #27648 -- Deprecated (iLmsu) regex groups in url() patterns) the render still very fast. I know there should be more processing from template based widget rendering. but this is just too much

In another test with django-treebeard admin page, the amount of time to render its admin page is 30 seconds. it's just unacceptable

comment:3 by Claude Paroz, 8 years ago

Does using the cached template loader (https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader) make a big difference here?

comment:4 by Sayid Munawar, 8 years ago

Hi Claude Paroz, the django template cached loader makes no big difference. still around 2 seconds to render a page. In my admin page which render admin page for django-treebeard, the cached loader makes no difference too. Maybe there is another issue from django-treebeard, idk. one thing for sure is that it was fine when using django 1.10, though it will take seconds to render a tree (django-treebeard, MP_Node) from thousands objects. But when using django 1.11alpha, the page is loading forever, no response.

comment:5 by Tim Graham, 8 years ago

Resolution: invalid
Status: newclosed

This isn't an issue in Django but rather caused if the Templates panel in the debug toolbar is enabled. I've filed an issue in its issue tracker.

comment:6 by Sayid Munawar, 8 years ago

disabling template analysis panel in django-debug-toolbar make my admin page fast again. sorry didn't try that before

Note: See TracTickets for help on using tickets.
Back to Top