-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dvc][server][samza] Heap size estimation improvement (#1281)
Introduced two new utilities to make our on-heap memory usage assessment more accurate, and easier to maintain as class hierarchies evolve: - ClassSizeEstimator: Predicts (based on assumptions about how the JVM's memory layout works) the shallow size of a class. This includes the object header, all primitive fields, and all references to other objects (but it does not count these other objects, hence the shallowness). Reflection is used in this class. - InstanceSizeEstimator: Predicts the size of instances of a limited number of classes. This is not a general-purpose utility, and it requires some manual effort to onboard a new class. Reflection is not used in this class. The general design goals are the following: - Reflection should only be used once per class per runtime, and the result of this logic should be stored in static constants. - On the hot path, there should be no reflection, and we should leverage our knowledge of the Venice code base to determine which objects are meant to be counted or not. For example, singleton or otherwise shared instances should not be counted, since their amortized cost is negligible (besides the size of the pointer to refer to them). The above utilities have been integrated in all classes that implement the Measurable interface, and several new classes have been given this interface as well. The Measurable::getSize function has been renamed getHeapSize, to minimize the chance that it could clash with other function names, and to make it extra clear what kind of size is meant. Miscellaneous: - Minor efficiency improvements to PubSubMessageHeaders and ApacheKafkaUtils so that empty headers (a common case) carry less overhead. Also made the PubSubMessageHeaders implement Iterable. - Created a DefaultLeaderMetadata static class in VeniceWriter, so that a shared instance can be leveraged in cases where that object is always the same (e.g. when producing to the RT topic). - BlobSnapshotManagerTest improvements: - Added timeouts to all tests. - Fixed a race condition in testMultipleThreads.
- Loading branch information
Showing
40 changed files
with
1,810 additions
and
185 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.