Alluxio / alluxio

Alluxio, data orchestration for analytics and machine learning in the cloud
https://www.alluxio.io
Apache License 2.0
6.81k stars 2.94k forks source link

Add fast method for PropertyKey default suppliers to lookup other property key values #13969

Open ZacBlanco opened 3 years ago

ZacBlanco commented 3 years ago

Is your feature request related to a problem? Please describe.

We should be able to set some property defaults as propertional to another property value. This can alleviate configuration changes to some portions of the system by limiting the number of properties a user has to change when attempting to optimize the system.

This should be able to be achieved today, but would incur a high startup overhead if implemented for more than a few properties

public static void PropertyKey keyname = new PropertyKey(...)
  .setDefaultSupplier(() -> ConfigurationUtils.defaults().get(<otherKeyName>) * 2
  ...

The issue with this implementation is that ConfigurationUtils.defaults() incurs a copy of the entire property hash map to prevent mutation to the default property set. If we had many keys calling the defaults() method this would be very slow

Describe the solution you'd like

We should implement a "fast" method to lookup properties from the default properties map, or return a read-only view of the map so that we can implement quick default lookups when the defaultSupplier method is called. This should be a pretty straightforward optimization.

Describe alternatives you've considered None currently.

Urgency Low

Additional context Original PR comment

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two weeks if no further activity occurs. Thank you for your contributions.