Django on Heroku psycopg2: connection is very slow

I am deploying a Django application on Heroku, and I see that most of the time in my requests is spent on a function psycopg2:connect.

See New Relic charts (blue - psycopg2: connect):

New relay chart

New relay table

I don't think spending 60% of the time in a db connection is adequate ...

I tried to use the connection pool with django-postgrespool, but did not notice any difference.

I use waitressas a server (according to this article http://blog.etianen.com/blog/2014/01/19/gunicorn-heroku-django/ ). The application runs on a hobby dynamo with the Postgresql base base for a hobby (will this improve?).

Any directions on how I can speed up these connections?


[UPDATE] , django rest api:

no problem with the browsable api

, 14:20, , ?format=json, , psycopg2:connect . , - django rest framework?

+4

Source: https://habr.com/ru/post/1598209/


All Articles