8000 [4.4] Tests slow after updating to 4.4 · Issue #34567 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[4.4] Tests slow after updating to 4.4 #34567

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

Closed
ro0NL opened this issue Nov 24, 2019 · 10 comments
Closed

[4.4] Tests slow after updating to 4.4 #34567

ro0NL opened this issue Nov 24, 2019 · 10 comments

Comments

@ro0NL
Copy link
Contributor
ro0NL commented Nov 24, 2019

Symfony version(s) affected: 4.4

Somehow our testsuite became extremely slow after updating to 4.4. It's a regular API platform setup, using hautelook fixtures. So DB is reloaded on every test.

In the var/cache/test it seems to boot/cache a compiled container container per testcase. If i abort after first testcase, and then restart the testsuite it seems to pick up the existing container.

Moreover, the behavior is exposed using:

# FAST
rm -rf var/cache/test
bin/phpunit

# SLOW
rm -rf var/cache/test
bin/console c:c -e test
bin/phpunit

# ALSO SLOW
rm -rf var/cache/test
bin/console c:c --no-warmup -e test
bin/phpunit

Im not sure where to look for now, hints welcome :) i've updated all recipes etc. so everything is "latest 4.4".

@nicolas-grekas
Copy link
Member

Check Blackfire.io for hints ;)

@ro0NL
Copy link
Contributor Author
ro0NL commented Nov 24, 2019

@nicolas-grekas it's caused by symfony/http-kernel@354bcae4

8000

@nicolas-grekas
Copy link
Member

If you want me to help, I'd need a reproducer. A blackfire comparison would be a good start in any case.

@acasademont
Copy link
Contributor

We're seeing our tests also being far slower in 4.4. Hopefully I can provide some Blackfire profiles tomorrow :)

@Kocal
Copy link
Member
Kocal commented Nov 25, 2019

Since Symfony 4.4 update, our PHPUnit tests now take ~9 minutes instead of ~15 seconds to run 586 tests and 610 assertions (we use KernelTestCase literally everywhere because we need to access the container).

Here some blackfire traces for only one file (running blackfire on every files make it crash):

rm -rf var/cache/test && bin/console c:c -e test
blackfire run bin/simple-phpunit tests/phpunit/Security/Voter/SectorVoterTest.php # slow
blackfire run bin/simple-phpunit tests/phpunit/Security/Voter/SectorVoterTest.php # fast

Thanks!

@acasademont
Copy link
Contributor

Feels like the container is built a gazillion times

@nicolas-grekas
Copy link
Member

Thanks for the hints. Can anyone please confirm #34580 fixes the issue?

@acasademont
Copy link
Contributor

@nicolas-grekas yes! test speeds are back to normal :D

@acasademont
Copy link
Contributor
8000

I'd say tests are even faster now, amazing!

@fabpot fabpot closed this as completed Nov 25, 2019
fabpot added a commit that referenced this issue Nov 25, 2019
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Don't cache "not-fresh" state

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34567
| License       | MIT
| Doc PR        | -

Commits
-------

be80db3 [HttpKernel] Don't cache "not-fresh" state
@stof
Copy link
Member
stof commented Nov 25, 2019

@acasademont sure they are. The initial change was meant to speed them up. But that's only true when the optimizing logic is not buggy.

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

6 participants
0