JDBC Input Memory Leak: Unclosed Connections and Worker Thread Impact
27.5K reputation · 29 Sept 2023, 10:31 UTC
Symptom
Logstash’s JDBC input plugin shows sustained heap growth when processing slow queries. The plugin’s default C3P0 pool may retain idle connections, especially under high load.
Goal
Determine how pipeline.workers and optional connection‑pool eviction settings influence memory usage over time.
Constraints & Uncertainty
Each worker can spawn its own connection pool, potentially multiplying leaks. The effect of idle_timeout on heap size is not fully quantified. Balancing throughput against memory consumption remains unresolved.
Questions
- What is the heap‑growth trend when
pipeline.workersis set to 1 versus the number of CPU cores? - Does enabling
idle_timeoutin the JDBC plugin’s C3P0 configuration effectively reduce open‑connection counts? - How do multiple worker threads each maintain separate connection pools, and can this behaviour be mitigated?