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 support for rendering a summary of objects held by the graph (cherrypick of #14638) #14644

Merged
merged 1 commit into from Feb 27, 2022

Conversation

stuhood
Copy link
Sponsor Member

@stuhood stuhood commented Feb 27, 2022

As described in #12662, some use cases have surprising memory usage. To enable tracking those cases down, this change adds a --memory-summary option which summarizes the deep sizes of live objects in the Graph.

On the Python side, the deep size is calculated using a very basic deduping walk of gc.get_referents (after having investigated pympler, guppy3, objsize). On the Rust side, the deepsize crate is used, with sizes derived for all types reachable from NodeKey and NodeOutput.

Example output:

Memory summary:
64		1		pants.backend.docker.subsystems.dockerfile_parser.DockerfileParser
64		1		pants.backend.docker.subsystems.dockerfile_parser.ParserSetup
64		1		pants.backend.java.dependency_inference.java_parser_launcher.JavaParserCompiledClassfiles
64		1		pants.backend.java.dependency_inference.symbol_mapper.FirstPartyJavaTargetsMappingRequest
<snip>
1588620		957		(native) pants.engine.internals.graph.hydrate_sources
2317920		2195		(native) pants.backend.python.dependency_inference.module_mapper.map_module_to_address
2774760		2434		(native) pants.engine.internals.graph.determine_explicitly_provided_dependencies
4446900		1458		(native) pants.engine.internals.graph.resolve_dependencies

[ci skip-build-wheels]

…tsbuild#14638)

As described in pantsbuild#12662, some use cases have surprising memory usage. To enable tracking those cases down, this change adds a `--memory-summary` option which summarizes the deep sizes of live objects in the `Graph`.

On the Python side, the deep size is calculated using a very basic deduping walk of `gc.get_referents` (after having investigated [pympler](https://pypi.org/project/Pympler/), [guppy3](https://pypi.org/project/guppy3/), [objsize](https://pypi.org/project/objsize/)). On the Rust side, the `deepsize` crate is used, with sizes derived for all types reachable from `NodeKey` and `NodeOutput`.

Example output:
```
Memory summary:
64		1		pants.backend.docker.subsystems.dockerfile_parser.DockerfileParser
64		1		pants.backend.docker.subsystems.dockerfile_parser.ParserSetup
64		1		pants.backend.java.dependency_inference.java_parser_launcher.JavaParserCompiledClassfiles
64		1		pants.backend.java.dependency_inference.symbol_mapper.FirstPartyJavaTargetsMappingRequest
<snip>
1588620		957		(native) pants.engine.internals.graph.hydrate_sources
2317920		2195		(native) pants.backend.python.dependency_inference.module_mapper.map_module_to_address
2774760		2434		(native) pants.engine.internals.graph.determine_explicitly_provided_dependencies
4446900		1458		(native) pants.engine.internals.graph.resolve_dependencies
```

[ci skip-build-wheels]
@stuhood stuhood force-pushed the stuhood/pick-14638-for-2.10.x branch from e50818d to d92de44 Compare February 27, 2022 04:10
@stuhood stuhood merged commit 5cd8a94 into pantsbuild:2.10.x Feb 27, 2022
@stuhood stuhood deleted the stuhood/pick-14638-for-2.10.x branch February 27, 2022 17:27
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

Successfully merging this pull request may close these issues.

None yet

2 participants