Skip to content

Prevents single-tenant overload from exhausting shared DB connection … - #3345

Draft
vasilchev wants to merge 1 commit into
eclipse-hawkbit:masterfrom
boschglobal:throttle/tenants
Draft

Prevents single-tenant overload from exhausting shared DB connection …#3345
vasilchev wants to merge 1 commit into
eclipse-hawkbit:masterfrom
boschglobal:throttle/tenants

Conversation

@vasilchev

Copy link
Copy Markdown
Contributor

…pool. Enforces fair-share admission control with contention-aware bursting.

What Changed

New components:

  • TenantThrottle — fair-share gate (hawkbit-core)
  • ThrottlingDataSourceDecorator — JDBC interception layer (hawkbit-autoconfigure)
  • ConnectionThrottleGate — permit lifecycle tied to connection close
  • REST exception mapper → HTTP 429 with Retry-After

Modified:

  • DataSource wrapped via BeanPostProcessor when enabled
  • System work (no tenant context) exempt
  • Nested transactions (REQUIRES_NEW) bypass reentrancy

Configuration Modes

1. No Throttle (current default)

hawkbit.throttle.enabled=false
DataSource untouched. Zero behavior change.

2. Hard Cap (strict limit, fast-reject)

hawkbit.throttle.enabled=true
hawkbit.throttle.limit=5           # each tenant max 5 concurrent connections
hawkbit.throttle.timeout=0         # reject immediately when over limit
hawkbit.throttle.threshold=-1      # no threshold (always enforce limit)
Behavior: Tenant holding 5 connections → 6th request gets HTTP 429 instantly. Other tenants unaffected. Safe on platform threads.

3. Contention-Aware Burst (threshold + backpressure)

hawkbit.throttle.enabled=true
hawkbit.throttle.limit=10          # ceiling per tenant
hawkbit.throttle.timeout=20s       # wait up to 20s before 429
hawkbit.throttle.threshold=8       # fairness kicks in at 8/10 pool utilization
spring.threads.virtual.enabled=true  # REQUIRED for timeout>0

@vasilchev
vasilchev force-pushed the throttle/tenants branch 3 times, most recently from bf961f1 to 12f9dab Compare September 10, 2026 18:44
…pool. Enforces fair-share admission control with contention-aware bursting.

  ### What Changed

  **New components:**
  - `TenantThrottle` — fair-share gate (hawkbit-core)
  - `ThrottlingDataSourceDecorator` — JDBC interception layer (hawkbit-autoconfigure)
  - `ConnectionThrottleGate` — permit lifecycle tied to connection close
  - REST exception mapper → HTTP 429 with Retry-After

  **Modified:**
  - DataSource wrapped via `BeanPostProcessor` when enabled
  - System work (no tenant context) exempt
  - Nested transactions (REQUIRES_NEW) bypass reentrancy

  ### Configuration Modes

  #### 1. **No Throttle** (current default)
  ```properties
  hawkbit.throttle.enabled=false
  DataSource untouched. Zero behavior change.

  2. Hard Cap (strict limit, fast-reject)

  hawkbit.throttle.enabled=true
  hawkbit.throttle.limit=5           # each tenant max 5 concurrent connections
  hawkbit.throttle.timeout=0         # reject immediately when over limit
  hawkbit.throttle.threshold=-1      # no threshold (always enforce limit)
  Behavior: Tenant holding 5 connections → 6th request gets HTTP 429 instantly. Other tenants unaffected. Safe on platform threads.

  3. Contention-Aware Burst (threshold + backpressure)

  hawkbit.throttle.enabled=true
  hawkbit.throttle.limit=10          # ceiling per tenant
  hawkbit.throttle.timeout=20s       # wait up to 20s before 429
  hawkbit.throttle.threshold=8       # fairness kicks in at 8/10 pool utilization
  spring.threads.virtual.enabled=true  # REQUIRED for timeout>0

Signed-off-by: vasilchev <vasil.ilchev@bosch.com>
@vasilchev
vasilchev marked this pull request as draft September 10, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant