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

Add loaded entities profiler section #1872

Merged
merged 7 commits into from
Mar 9, 2025

Conversation

mamazu
Copy link

@mamazu mamazu commented Feb 26, 2025

The Feature

Showing a list of entity classes and the amount of entities that are managed:
image

The reasoning

Doctrine has a nice lazy loading feature of entities however I don't think many people realize that this can create a huge object graph in the entity manager. As flushing will go in and check all the entities for updates.

@mamazu mamazu force-pushed the managed_entity_count branch from 1602c5e to b4dd3e4 Compare February 26, 2025 16:53
Copy link
Contributor

@dmaicher dmaicher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 from my side. Also tested it on one of my projects.

Should target 2.14.x though as its a new feature

@dmaicher
Copy link
Contributor

dmaicher commented Feb 26, 2025

One observation: I have an app with 2 different databases and 2 entity managers.
Currently the managed entity counts are displayed together in one table for both entity managers.

Should it maybe be split into different tables per entity manager instead as we do for the "Entities Mapping" tab?

@stof
Copy link
Member

stof commented Feb 26, 2025

it should indeed be per entity manager

@mamazu mamazu force-pushed the managed_entity_count branch from b4dd3e4 to 28f5b33 Compare February 26, 2025 21:56
@mamazu mamazu changed the base branch from 2.13.x to 2.14.x February 26, 2025 21:56
@mamazu mamazu force-pushed the managed_entity_count branch from 28f5b33 to 83e4a8b Compare February 26, 2025 21:58
@mamazu
Copy link
Author

mamazu commented Feb 26, 2025

Rebased and split up between entity managers:
image

@dmaicher dmaicher added this to the 2.14.0 milestone Feb 27, 2025
mamazu and others added 2 commits February 27, 2025 10:55
Co-authored-by: Christophe Coevoet <stof@notk.org>
Co-authored-by: David Maicher <mail@dmaicher.de>
@mamazu mamazu force-pushed the managed_entity_count branch from 527f0b1 to 018423b Compare February 27, 2025 10:00
@mamazu
Copy link
Author

mamazu commented Mar 3, 2025

Should I also add a little text explaining that this only shows the amount of managed entities at the end of the program when the collector runs?

@ostrolucky
Copy link
Member

No need I would say, that's how collector stats are usually collected. But I would welcome if there was as an assertion for this in ProfilerTest, that's our integration test for profiler.

@mamazu mamazu force-pushed the managed_entity_count branch from c384477 to 9b6a396 Compare March 9, 2025 09:48
@mamazu mamazu force-pushed the managed_entity_count branch from 9b6a396 to 123bfcd Compare March 9, 2025 09:52
@ostrolucky ostrolucky changed the title Showing managed entity count Add loaded entity profiler section Mar 9, 2025
@ostrolucky ostrolucky changed the title Add loaded entity profiler section Add loaded entities profiler section Mar 9, 2025
@ostrolucky ostrolucky merged commit fdeecd4 into doctrine:2.14.x Mar 9, 2025
12 checks passed
@mamazu mamazu deleted the managed_entity_count branch March 9, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants