cobrateam / cobrateam/django-htmlmin

Introducing the middleware makes everything slooooooooooow

Open
#80 9 comments 1 reaction 0 assignees View on GitHub
Bug
Dominant language
Python
Stars
542
Forks
72
PR merge metrics
No merged PRs in 30d

Description

One of our heavier pages was taking a very long time to load and often timing out. Took ages to understand why this is happening in production and not in development, and eventually we realised that setting DEBUG to False is what makes things slower (unintuitively). Turns out the culprit was the htmlmin middleware.

Other than general optimization, one solution could be to bail out and serve the unminified input if minification hasn't completed within a certain timeout period.

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names the htmlmin middleware but no files or tests. Start by profiling the middleware on the affected production-style page with DEBUG=False and compare it with development behavior. Done means the slowdown and timeouts are addressed, with unminified input served if a timeout-based fallback is chosen.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.