Conversation
This commit adds a new WithDisableTopology() option that allows users to skip system topology detection when calling ghw.PCI() or ghw.GPU(), significantly reducing memory consumption for use cases that don't require NUMA topology information. Signed-off-by: Yan Zhu <hackzhuyan@gmail.com>
Owner
Author
|
@halfcrazy thank you very much for your contribution! welcome to the ghw contributors membership :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds a new WithDisableTopology() option that allows users to skip system topology detection when calling ghw.PCI() or ghw.GPU(), significantly reducing memory consumption for use cases that don't require NUMA topology information.
Performance impact on real production servers:
Dual-socket server (2 NUMA nodes, 96 cores):
BenchmarkPCIMemoryComparison/WithTopologyDetection 100 100708875 ns/op 29332384 B/op 289365 allocs/op
BenchmarkPCIMemoryComparison/WithDisableTopology 100 58473485 ns/op 17201283 B/op 247006 allocs/op
Memory: 41% reduction (28 MB -> 16.4 MB)
Time: 42% faster (100.7 ms -> 58.5 ms)
Allocations: 15% fewer (289,365 -> 247,006)
Quad-socket server (4 NUMA nodes, 128 cores):
BenchmarkPCIMemoryComparison/WithTopologyDetection 100 448132406 ns/op 344566098 B/op 257009 allocs/op
BenchmarkPCIMemoryComparison/WithDisableTopology 100 64284435 ns/op 18707107 B/op 193877 allocs/op
Memory: 94.6% reduction (328 MB -> 17.8 MB)
Time: 85.7% faster (448 ms -> 64 ms)
Allocations: 24.6% fewer (257,009 -> 193,877)
Saves 310 MB per call - critical for large deployments