Introduction
The aggregate provider configuration is key to accelerate the users queries. It is a compromise between memory usage and speed. The AI Optimizer can recommend a provider configuration tailored to your query history. It is now possible to use this recommendation (or any provider description) to change the provider configuration dynamically without restarting the application.
Enabling the dynamic aggregate provider feature
The dynamic aggregate provider must be enabled by setting the system
property activeviam.feature.experimental.dynamic_aggregate_provider.enabled
to true
.
Adding a partial provider
First, define the partial provider:
final PartialProviderDefinition provider =
new PartialProviderDefinition(
"MyProvider",
IAggregateProviderDefinition.BITMAP_PLUGIN_TYPE,
List.of(LevelIdentifier.simple("id")),
List.of("value.SUM"),
PartialProviderFilters.noFilter(),
new Properties(),
null);
Then call the API to add the partial provider to the aggregate provider configuration:
DynamicAggregateProvider.updateAggregateProviders(
manager, t -> t.addNewPartialAggregateProvider(CUBE, provider));
Removing a partial provider
To delete an existing provider, we simply use its name:
DynamicAggregateProvider.updateAggregateProviders(
manager, t -> t.removePartialAggregateProvider(CUBE, "MyProvider"));
Batching operations
It is possible to add and remove several partial providers at once.
DynamicAggregateProvider.updateAggregateProviders(
manager,
t -> {
t.addNewPartialAggregateProvider(CUBE, provider1)
.addNewPartialAggregateProvider(CUBE, provider2);
});