Skip to content

perf(server): virtual threads, hot-path log demotion, JMX guard, 64 KB LOB blocks#495

Merged
rrobetti merged 2 commits intomainfrom
copilot/reduce-ojp-impact-on-latency
May 8, 2026
Merged

perf(server): virtual threads, hot-path log demotion, JMX guard, 64 KB LOB blocks#495
rrobetti merged 2 commits intomainfrom
copilot/reduce-ojp-impact-on-latency

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Four targeted changes to reduce OJP proxy overhead on latency and throughput.

Virtual threads (was: fixed thread pool of 200)

// GrpcServer.java
- .executor(Executors.newFixedThreadPool(config.getThreadPoolSize()))
+ .executor(Executors.newVirtualThreadPerTaskExecutor())

Every gRPC handler that blocks on JDBC I/O previously pinned a platform thread. With a 20-connection pool, only 20 requests could execute SQL concurrently; the remaining 180 threads were parked. Virtual threads yield during blocking I/O and remove the hard throughput ceiling. ojp.server.threadPoolSize is preserved but now logged as ignored.

Hot-path log.infolog.debug

SLF4J evaluates arguments at INFO level regardless of whether any appender writes them — string allocation + timestamp construction on every SQL call. Demoted in:

  • ExecuteQueryAction, ExecuteUpdateAction
  • StartTransactionAction, CommitTransactionAction, RollbackTransactionAction
  • SessionManagerImpl (session create/terminate/LOB lifecycle)
  • CreateLobAction, ReadLobAction

JMX stats gated in ConnectionAcquisitionManager

HikariCP's getHikariPoolMXBean() methods acquire a brief internal pool lock. The stats-gathering block now only executes when:

  • log.isDebugEnabled(), or
  • a real metrics collector (not NoOpPoolMetrics) is active

Under default production settings (INFO, no OTel), the lock is never taken on the connection acquisition hot path.

LOB block size 1 KB → 64 KB

CommonConstants.MAX_LOB_DATA_BLOCK_SIZE: 102465536. A 1 MB BLOB previously required 1,024 block transfers; now 16, proportionally reducing LOB streaming latency and per-block gRPC serialisation overhead.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

@rrobetti rrobetti marked this pull request as ready for review May 8, 2026 05:46
@rrobetti rrobetti merged commit cab2610 into main May 8, 2026
53 checks passed
@rrobetti rrobetti deleted the copilot/reduce-ojp-impact-on-latency branch May 8, 2026 05:46
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.

2 participants