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 Regression 5.x #3166

Closed
jensk opened this issue Oct 1, 2024 · 4 comments · Fixed by #3167
Closed

Performance Regression 5.x #3166

jensk opened this issue Oct 1, 2024 · 4 comments · Fixed by #3167

Comments

@jensk
Copy link

jensk commented Oct 1, 2024

  • Laravel-mongodb Version: 5.0.2
  • PHP Version: 8.3.12
  • Database Driver & Version: pecl/mongodb-1.20.0

Description:

Hello,

We are experiencing a significant performance regression after upgrading to the latest version 5.0.2.

Our test suite, comprising approximately 400 tests, 2,000 assertions, and 15,000 queries, used to complete in about 15 seconds with version 4.8.0. After the upgrade, it now takes around 50 seconds to complete. (on my local dev box)

Individual HTTP requests or single tests do not exhibit any issues. In fact, performance for our average web request has slightly improved.

The issue only shows up in long-running processes, such as a test suite.

I have created a demo Laravel application that demonstrates the problem in a simple, isolated manner: Demp-App
We were able to reproduce the issue in 3 different environments:

  • WSL2-Ubuntu/Mongo-7 via docker,
  • Archlinux/Mongo-7 via docker,
  • Gentoo/Mongo 4.4 without docker

Steps to reproduce

  1. git clone https://github.com/jensk/lara-mongo-debug
  2. composer install
  3. vendor/bin/phpunit

Expected behaviour

Execution time of the tests should remain stable. (Example results with 4.8)

Actual behaviour

Execution time increases slightly and linearly with each call to the various methods of laravel-mongodb. (e.g. truncate, delete, create ...) (Example results with 5.0.2)

@GromNaN
Copy link
Member

GromNaN commented Oct 1, 2024

Thank you for the report and the demo app; that will definitely help us investigate. This issue is tracked in our Jira for investigation PHPORM-248.

I'll check the CommandSubscriber.

@jensk
Copy link
Author

jensk commented Oct 1, 2024

Thanks for the quick response! <3
If I can help any further to track this down, please let me know.

@GromNaN
Copy link
Member

GromNaN commented Oct 3, 2024

As I suspected, it's the command subscriber that's at fault. I've open a PR to register it only when logs are enabled. #3167

@jensk
Copy link
Author

jensk commented Oct 6, 2024

Thank you very much. 5.x works like a charm now.

Btw, v5 is an awesome release! We appreciate the great work you put into this package.

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

Successfully merging a pull request may close this issue.

2 participants