Skip to content

Transport causes CPU Spikes on Larger Envelopes #2384

@mitsuhiko

Description

@mitsuhiko

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.31

Steps to Reproduce

Sending this to Sentry causes the transport to create CPU spikes that are very visible in our kubernetes pods.

from sentry_sdk import capture_message, push_scope

for _ in range(50):
    with push_scope() as scope:
        scope.add_attachment(bytes=b"Hello World! " * 10000, filename="attachment.txt")
        capture_message('Hello, hello.')

It also happens if gzip compression is disabled. It appears to be related to how capture_envelope works within the transport.

Expected Result

I would not expect the CPU usage to spike.

Actual Result

It spikes.

Metadata

Metadata

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions