Make seeder thread pool sizes configurable (fixes #1429)#1535
Make seeder thread pool sizes configurable (fixes #1429)#1535petersmythe wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Makes the GeoWebCache seeder thread pool core/max sizes configurable at the Java level (system property → env var → constructor default), so they can be overridden without editing Spring XML. The constructor signature is unchanged, preserving backward compatibility with SeederThreadLocalTransferExecutor and existing wirings.
Changes:
- Add
GWC_SEEDER_CORE_POOL_SIZE/GWC_SEEDER_MAX_POOL_SIZEconstants and aresolvePoolSizehelper inSeederThreadPoolExecutor, with auto-adjustment when core > max and a startup info log of the effective sizes. - New
SeederThreadPoolExecutorTestcovering defaults, overrides, invalid/blank/negative values, whitespace trimming, and core-exceeds-max adjustment, using the existingPropertyRuletest rule. - Documentation section added under
production/index.rstdescribing the new properties, precedence, and the auto-adjust behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| geowebcache/core/src/main/java/org/geowebcache/seed/SeederThreadPoolExecutor.java | Adds runtime resolution of core/max pool sizes from system properties/env vars with fallback to constructor defaults. |
| geowebcache/core/src/test/java/org/geowebcache/seed/SeederThreadPoolExecutorTest.java | New unit tests exercising default, override, invalid, and core>max scenarios via PropertyRule. |
| documentation/en/user/source/production/index.rst | Documents the new configuration properties, precedence, and adjustment behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
45234f5 to
1a12d25
Compare
|
GeoWebCache has a configuration file, it's geowebcache.xml, new configurations should go in there... an env variable override makes some sense too, but as an override, not straight configuration. Most of the GWC configuration is in that XML file, we should not create a parallel configuration system just because it's convenient to code. |
Thank you, of course it should. I will rework. |
1a12d25 to
d6bc15b
Compare
Add documentation for GWC_SEEDER_CORE_POOL_SIZE and GWC_SEEDER_MAX_POOL_SIZE environment variables / system properties that allow configuring the seeder thread pool size. - Add new 'Seeder thread pool size' section to geowebcache/seeding.md - Add entries to the Application Properties reference table Accompanies GeoWebCache/geowebcache#1535
…v vars Allow GWC_SEEDER_CORE_POOL_SIZE and GWC_SEEDER_MAX_POOL_SIZE to be specified as Java system properties or OS environment variables, with system properties taking precedence. Falls back to the Spring XML constructor arguments (16/32) when not set or invalid. Invalid values (non-numeric, zero, negative) are logged as warnings and the defaults are used. If corePoolSize exceeds maxPoolSize after resolution, maxPoolSize is automatically adjusted upward to match. Includes unit tests and documentation updates. Closes GeoWebCache#1429
d6bc15b to
b57d1f9
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Ready and tested again. Thanks for the feedback. |
Add documentation for GWC_SEEDER_CORE_POOL_SIZE and GWC_SEEDER_MAX_POOL_SIZE environment variables / system properties that allow configuring the seeder thread pool size. - Add new 'Seeder thread pool size' section to geowebcache/seeding.md - Add entries to the Application Properties reference table Accompanies GeoWebCache/geowebcache#1535
Summary
Makes the GeoWebCache seeder thread pool sizes configurable via
geowebcache.xml(primary configuration) with environment variable overrides for Docker/cloud deployments, as requested in #1429.Previously, the core pool size (16) and max pool size (32) were hardcoded in Spring XML with no way to override them without modifying the application context.
Configuration
Primary: geowebcache.xml
seederCorePoolSizeseederMaxPoolSizeOverride: Environment variables
For Docker/cloud deployments, the XML configuration can be overridden:
GWC_SEEDER_CORE_POOL_SIZEseederCorePoolSizeGWC_SEEDER_MAX_POOL_SIZEseederMaxPoolSizePrecedence: Environment variable / system property (
-D) →geowebcache.xml→ hardcoded default (16/32).Changes
ServerConfiguration: AddedgetSeederCorePoolSize()/getSeederMaxPoolSize()default interface methods.GeoWebCacheConfiguration: AddedseederCorePoolSize/seederMaxPoolSizefields (POJO for geowebcache.xml).geowebcache.xsd: Added<seederCorePoolSize>and<seederMaxPoolSize>schema elements.geowebcache.xml(example): Added commented-out example.geowebcache-core-context.xml: Bean wiring now reads fromgwcXmlConfigvia SpEL, falling back to 16/32.SeederThreadPoolExecutor: AddedresolvePoolSize()for env var override with validation (invalid values fall back to defaults, core > max auto-adjusts).SeederThreadPoolExecutorTestwith 9 test cases.production/index.rst.Backward Compatibility
seederCorePoolSize/seederMaxPoolSizein theirgeowebcache.xmlcontinue to work unchanged.SeederThreadLocalTransferExecutor(GeoServer subclass) works without modification.Testing
GWC_SEEDER_CORE_POOL_SIZE=24viajcmd Thread.print.Supersedes
This replaces the approach in #1430 which used Spring property placeholders in the XML. That approach had test failures and didn't meet the requirement of being configurable outside of application contexts.
Closes #1429