You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a very interesting, and terrifying, problem. The number of requests/second dramatically decreases up to a point Django explodes when using django_prometheus and the new connection pooling.
Then, the Requests/sec start to decrease in subsequent runs:
Run 1:
Requests/sec: 53.0024
Run 2:
Requests/sec: 138.1491
Run 3:
Requests/sec: 128.2628
Run 4:
Requests/sec: 110.5167
Run 5:
Requests/sec: 114.9347
Run 6:
Requests/sec: 108.7823
Run 7:
Requests/sec: 103.1321
Run 8:
Requests/sec: 90.7509
Run 9:
Requests/sec: 91.4321
Run 10:
Requests/sec: 83.5613
Run 11:
Requests/sec: 86.0125
Run 12:
Requests/sec: 76.2282
Run 13:
Requests/sec: 78.4934
Run 14:
Requests/sec: 70.1448
Run 15:
Requests/sec: 68.1487
Note I used this cute command to run the test: for i in {1..15}; do echo "Run $i:"; hey -c 1 -n 100 https://127.0.0.1/api/v1/test/ | awk '/Requests\/sec/'; echo ""; done
I am not sure why this happens, however, it has to do with connections and cursors (in this file of the repo?).
The text was updated successfully, but these errors were encountered:
I have found this Django ticket where they mention that connections must be closed when not ran in django e.g. in other services like celery, etc. Could it be possible that the Prometheus logging is not closing the connections?
The new Django 5.1 version adds connection pools for postgresql.
I noticed a very interesting, and terrifying, problem. The number of requests/second dramatically decreases up to a point Django explodes when using
django_prometheus
and the new connection pooling.I tested with this database settings:
And these requirements:
I noticed the problem using this command:
hey -c 1 -n 100 https://127.0.0.1/api/v1/test/
With this view:
Where
Origin
is a simple model:Note that using
django.db.backends.postgresql
works as expected, steadily. Also, removing theOPTIONS
key also avoids the issue.When running the benchmark with
hey -c 1 -n 100 https://127.0.0.1/api/v1/test/
I get a report likeThen, the Requests/sec start to decrease in subsequent runs:
Note I used this cute command to run the test:
for i in {1..15}; do echo "Run $i:"; hey -c 1 -n 100 https://127.0.0.1/api/v1/test/ | awk '/Requests\/sec/'; echo ""; done
I am not sure why this happens, however, it has to do with connections and cursors (in this file of the repo?).
The text was updated successfully, but these errors were encountered: