[Django] #35576: Django too slow on first request

6 views
Skip to first unread message

Django

unread,
4:17 AM (14 hours ago) 4:17 AM
to django-...@googlegroups.com
#35576: Django too slow on first request
-------------------------------------+-------------------------------------
Reporter: Sridhar | Type:
| Cleanup/optimization
Status: new | Component:
| Uncategorized
Version: 2.2 | Severity: Normal
Keywords: Django, Lambda | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
We have deployed our Django app on lambda, the first request always takes
5-6 seconds excluding lambda cold start times.

`get_app_list` and `reverse functions` take too long. The reverse function
to prepare and match uri takes O(n).
I am attaching the Cprofile results below.
--
Ticket URL: <https://code.djangoproject.com/ticket/35576>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
4:22 AM (14 hours ago) 4:22 AM
to django-...@googlegroups.com
#35576: Django too slow on first request
-------------------------------------+-------------------------------------
Reporter: Sridhar | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution:
Keywords: Django, Lambda | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sridhar):

* Attachment "Screenshot from 2024-07-05 10-13-16.png" added.

Django

unread,
4:28 AM (14 hours ago) 4:28 AM
to django-...@googlegroups.com
#35576: Django too slow on first request
-------------------------------------+-------------------------------------
Reporter: Sridhar | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution:
Keywords: Django, Lambda | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Sridhar:

Old description:

> We have deployed our Django app on lambda, the first request always takes
> 5-6 seconds excluding lambda cold start times.
>
> `get_app_list` and `reverse functions` take too long. The reverse
> function to prepare and match uri takes O(n).
> I am attaching the Cprofile results below.

New description:

We have deployed our Django app on lambda, the first request always takes
5-6 seconds excluding lambda cold start times.

My Observations:
- `get_app_list` and `reverse functions` take too long.
- The reverse function to prepare and match uri takes O(n).
- Django adds two URLs for every model we register, so this wait time
increases as we add models or write our own rest apis.

I am attaching the Cprofile results below.

--
--
Ticket URL: <https://code.djangoproject.com/ticket/35576#comment:1>

Django

unread,
4:31 AM (14 hours ago) 4:31 AM
to django-...@googlegroups.com
#35576: Django too slow on first request
-------------------------------------+-------------------------------------
Reporter: Sridhar | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution:
Keywords: Django, Lambda | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Sridhar:

Old description:

> We have deployed our Django app on lambda, the first request always takes
> 5-6 seconds excluding lambda cold start times.
>
> My Observations:
> - `get_app_list` and `reverse functions` take too long.
> - The reverse function to prepare and match uri takes O(n).
> - Django adds two URLs for every model we register, so this wait time
> increases as we add models or write our own rest apis.
>
> I am attaching the Cprofile results below.

New description:

We have deployed our Django app on lambda, the first request always takes
5-6 seconds excluding lambda cold start times.

My Observations:
- `get_app_list` and `reverse functions` take too long.
- The reverse function to prepare and match uri takes O(n).
- Django adds two URLs for every model we register, so this wait time
increases as we add models or write the Rest APIs.

I am attaching the Cprofile results below. Let me know if there are any
ways to optimize this.

--
--
Ticket URL: <https://code.djangoproject.com/ticket/35576#comment:2>

Django

unread,
6:26 AM (12 hours ago) 6:26 AM
to django-...@googlegroups.com
#35576: Django too slow on first request
-------------------------------------+-------------------------------------
Reporter: Sridhar | Owner: (none)
Type: | Status: closed
Cleanup/optimization |
Component: Uncategorized | Version: 2.2
Severity: Normal | Resolution: invalid
Keywords: Django, Lambda | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* resolution: => invalid
* status: new => closed

Comment:

Thanks for this ticket, however, Django 2.2 is not supported and we've
made a ton of improvements and optimizations since then. To submit a valid
ticket you have to propose a concrete optimization targeted to the current
`main` branch.

As a side note, you should ask for help on [support channels
https://forum.djangoproject.com/]. As for me, deploying a full Django
project on lambdas doesn't sound like the best idea.
--
Ticket URL: <https://code.djangoproject.com/ticket/35576#comment:3>
Reply all
Reply to author
Forward
0 new messages