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

Make LayerGroupContainmentCache available only on required services #469

Merged
merged 1 commit into from
May 15, 2024

Conversation

groldan
Copy link
Member

@groldan groldan commented May 14, 2024

LayerGroupContainmentCache can incur in quite a performance penalty during startup, as it'll get all layer groups and the layers/groups they're linked to.

LayerGroupContainmentCache is a securtity subsystem aid only used by WMS.

This patch contributes a no-op implementation or a customized one depending on the value of the
geoserver.security.layergroup-containmentcache boolean config property, which is set to true in the default config's geoserver.yml for the wms, gwc, and webui services.

Additionally, the customized LayerGroupContainmentCache implementation avoids re-creating the cache multiple times during startup. The original implementation does it at the class constructor and on a ContextRefreshedEvent event.
Now, this event is triggered on any ApplicationContext refreshed, which for our spring boot services was being triggered three times: for the app context itself, the servlet context, and the actuator context.

Now we make sure the cache is built only when the root application context is refreshed.

`LayerGroupContainmentCache` can incur in quite a performance penalty
during startup, as it'll get all layer groups and the layers/groups
they're linked to.

`LayerGroupContainmentCache` is a securtity subsystem aid only used by
WMS.

This patch contributes a no-op implementation or a customized one
depending on the value of the
`geoserver.security.layergroup-containmentcache` boolean config
property, which is set to `true` in the default config's `geoserver.yml`
for the `wms`, `gwc`, and `webui` services.

Additionally, the customized `LayerGroupContainmentCache` implementation
avoids re-creating the cache multiple times during startup. The original
implementation does it at the class constructor and on a
`ContextRefreshedEvent` event.
Now, this event is triggered on any `ApplicationContext` refreshed,
which for our spring boot services was being triggered three times:
for the app context itself, the servlet context, and the actuator
context.

Now we make sure the cache is built only when the root application
context is refreshed.
@groldan groldan added the enhancement New feature or request label May 14, 2024
@groldan groldan merged commit ec7d0cc into geoserver:main May 15, 2024
2 checks passed
@groldan groldan deleted the layergroupcontainmentcache branch May 15, 2024 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant