mozilla / mozilla-django-oidc

A django OpenID Connect library
https://mozilla-django-oidc.readthedocs.io
Mozilla Public License 2.0
444 stars 166 forks source link

Performance issue #503

Open Podolyan98 opened 1 year ago

Podolyan98 commented 1 year ago

I configured mozilla-django-oidc according to the documentation (Installation and DRF). Then I ran the Locust test:

from locust import HttpUser, task

token = 'token123'
shift_id = 'e048f80c-56e6-465a-8b20-fe5744ec0239'

class ReadShiftsTest(HttpUser):
    @task
    def test_read_shifts(self):
        url = f'api/shifts/{shift_id}'
        headers = {
            'Authorization': f'Bearer {token}'
        }
        self.client.get(url, headers=headers)

Number of users: 100 Spawn rate (users started/second): 100 Host: http://0.0.0.0:8888

Type     Name                                                                          # reqs      # fails |    Avg     Min     Max    Med |   req/s  failures/s
--------|----------------------------------------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
GET      /api/shifts/e048f80c-56e6-465a-8b20-fe5744ec0239                                3509    27(0.77%) |   6894     934   92222   4400 |   13.61        0.10
--------|----------------------------------------------------------------------------|-------|-------------|-------|-------|-------|-------|--------|-----------
         Aggregated                                                                      3509    27(0.77%) |   6894     934   92222   4400 |   13.61        0.10

In the end, I only got ~14 RPS. What should I do to improve performance?