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

Performance issue in aliases.php when not using all components that can be traced #827

Closed
stefangr opened this issue Apr 5, 2024 · 2 comments

Comments

@stefangr
Copy link

stefangr commented Apr 5, 2024

How do you use Sentry?

Self-hosted / on-premises

SDK version

4.14.0

Steps to reproduce

  1. We run a heavy traffic website that uses symfony to serve out it's pages.
  2. This symfony project does not use doctrine/dbal.
  3. We added sentry-symfony to it without tracing enabled.

Expected result

The code has a minimal perfomance penalty, as we do load the sentry components for error reporting.

Actual result

The overall performance of a request decreases too much.

The reason behind this is that the autoloader is looking up the Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingStatement class over and over again (and doing multiple requests to the file system [NFS] in the process), because classes that cannot be found, will not be cached in opcache.

@stefangr
Copy link
Author

stefangr commented Apr 5, 2024

Ideally, determining which of the tracing classes to use is done once (when the symfony service container is being build) and not on every request.

@cleptric
Copy link
Member

cleptric commented Apr 8, 2024

There quite a few ways you can improve autoloader performance, outlined here https://getcomposer.org/doc/articles/autoloader-optimization.md.

By default, the Composer autoloader runs relatively fast. However, due to the way PSR-4 and PSR-0 autoloading rules are set up, it needs to check the filesystem before resolving a classname conclusively. This slows things down quite a bit, but it is convenient in development environments because when you add a new class it can immediately be discovered/used without having to rebuild the autoloader configuration.

The problem however is in production you generally want things to happen as fast as possible, as you can rebuild the configuration every time you deploy and new classes do not appear at random between deploys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants