Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Testing Cache Spans in Django #3907

Closed
antonpirker opened this issue Jan 8, 2025 · 4 comments
Closed

Load Testing Cache Spans in Django #3907

antonpirker opened this issue Jan 8, 2025 · 4 comments

Comments

@antonpirker
Copy link
Member

antonpirker commented Jan 8, 2025

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

@antonpirker
Copy link
Member Author

antonpirker commented Jan 8, 2025

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

@antonpirker
Copy link
Member Author

antonpirker commented Jan 8, 2025

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

@antonpirker
Copy link
Member Author

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

@antonpirker
Copy link
Member Author

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.

@antonpirker antonpirker changed the title Load Testing Cache Spans Load Testing Cache Spans in Django Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant