File tree Expand file tree Collapse file tree 1 file changed +5
-19
lines changed
Expand file tree Collapse file tree 1 file changed +5
-19
lines changed Original file line number Diff line number Diff line change 99
1010## Connection Pool Unwrapping
1111
12- The JDBC instrumentation requires unwrapping pooled connections (via ` java.sql.Wrapper ` ) to
13- correctly attribute database operations to the underlying connection and to cache metadata. Most
14- connection pools support this by default.
12+ The instrumentation unwraps pooled connections (via java.sql.Wrapper) to cache database metadata
13+ against the underlying physical connection. Most connection pools support this by default.
1514
16- ** Performance issue?** If unwrapping fails, the instrumentation may have degraded performance or
17- increased overhead with some JDBC drivers. Metadata extraction may result in database queries on
18- every operation (depending on driver implementation and caching behavior) instead of being cached,
19- and operations may be attributed to the wrong database connection. To fix, ensure your connection
20- pool supports unwrapping:
21-
22- ** Vibur DBCP example:**
23- ``` java
24- ds. setAllowUnwrapping(true );
25- ```
26-
27- ** Custom wrappers:** Implement ` java.sql.Wrapper ` correctly to delegate ` isWrapperFor() ` and
28- ` unwrap() ` to the underlying connection.
29-
30- ** Failover note:** Cached metadata uses the unwrapped connection object as the key. If your pool
31- reuses the same connection object after failover, telemetry may show stale host attributes.
15+ In the case that a connection pool doesn't support this, caching is limited
16+ to the wrapper instance, which typically changes each time a connection is retrieved from the pool.
17+ This can result in repeated metadata extraction, potentially causing performance degradation.
You can’t perform that action at this time.
0 commit comments