Skip to content

Load Testing Cache Spans in Django #3907

Closed

Description

@antonpirker

We are thinking about enable cache spans in Django by default.

Adding spans for each access to a cache adds some overhead.

This issue is the documentation of load testing we did using the Python SDK v2.19.0.

The project used for this tests and also the reports can be found here:

https://github.com/antonpirker/testing-sentry/tree/main/test-django-cache-module/reports/sdk_v2.19.2

Activity

  1. antonpirker commented on Jan 8, 2025

    @antonpirker
    ContributorAuthor

    Setup

    Sentry Python SDK 2.19.2.

    Django application with one view (url "/") that does multiple (around 110) requests to a Redis cache.

    Access this view by 100 concurrent users constantly over a duration of 5 minutes.

    Baseline

    Run the test for 5 minutes without Sentry enabled at all.
    (Memory usage is about 50mb, the server manages to serve almost 12 requests per second)

    Image

    Image

    With Sentry / Without Cache Spans

    Run the test for 5 minutes with Sentry enabled, but no Cache spans. (so default Sentry setup)
    (Memory usage is about 80mb, the server manages to serve 9 requests per second)

    Image

    Image

    With Sentry / With Cache Spans.

    Run the test for 5 minutes with Sentry and cache spans enabled. Each request generates around 110 cache spans.
    (Memory usage is about 80mb, the server manages to serve around 6 requests per second)

    Image

    Image

  2. antonpirker commented on Jan 8, 2025

    @antonpirker
    ContributorAuthor

    Setup

    Sentry Python SDK 2.19.2.

    Django application with one view (url "/") that does LOTS (around 660) requests to a Redis cache.

    Access this view by 100 concurrent users constantly over a duration of 5 minutes.

    With Sentry / LOTS of cache requests / NO Cache Spans

    Run the test for 5 minutes with Sentry and NO cache spans. Each request makes around 660 cache request.
    (Memory usage is about 100mb, the server manages to serve only 1.5 requests per second)

    Image

    Image

    With Sentry / LOTS of cache requests / With Cache Spans

    Run the test for 5 minutes with Sentry and cache spans enabled. Each request makes around 660 cache request.
    (Memory usage is about 100mb, the server manages to serve only 1.3 requests per second)

    Image

    Image

  3. antonpirker commented on Jan 8, 2025

    @antonpirker
    ContributorAuthor

    Just to make sure I ran the test for 15 minutes that creates cache spans (the 110 cache spans per request) to see if the memory keeps growing. But it seems the curve flattens out, so this is good.

    Image

  4. antonpirker commented on Jan 9, 2025

    @antonpirker
    ContributorAuthor

    The load tests seem fine. We enabled cache spans on sentry itself and it did not add any noticeable overhead (in terms of memory usage or response times) to cached Django views.

  5. changed the title [-]Load Testing Cache Spans[/-] [+]Load Testing Cache Spans in Django[/+] on Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions