#34713: Sitemap index performance regression --------------------------------------------+------------------------ Reporter: Christoph Krybus | Owner: nobody Type: Uncategorized | Status: new Component: contrib.sitemaps | Version: 4.1 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | --------------------------------------------+------------------------ In django 4.1+ <lastmod> was added to sitemap index (https://code.djangoproject.com/ticket/25916)
One consequence of this is that django loads now the whole queryset into memory in order to determine the lastmod value for each sitemap entry in the sitemap index. In django versions < 4.1 this was not the case, the paginator just needed to know the number of elements to generate links to the sitemaps. My sitemap has ~1.5M entries, it worked OK in django 4.0, in django 4.1 the VM comes to a standstill. There seem to be no way to disable this new feature without also disabling lastmod on single entries. As a workaround I'm overriding the whole view right now. For the vast majority of sites the worse performance should not be a problem, but maybe there could be a setting or at least an overridable parameter to disable it? The index view https://github.com/django/django/blob/4.2.3/django/contrib/sitemaps/views.py#L65 has already a variable called all_indexes_lastmod maybe it could be initialized by a new index view argument? Something like `enable_index_lastmod=True`. -- Ticket URL: <https://code.djangoproject.com/ticket/34713> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/010701895b4ea1a5-793a909f-1b93-4eb0-b239-535edc7e8938-000000%40eu-central-1.amazonses.com.