Skip to content

Conversation

Oscarcheng0312
Copy link
Contributor

Ⅰ. Describe what this PR did

Enhances the heartbeat mechanism to periodically report client-side connection pool information to the Seata server
via Seata’s private network protocol (Netty RPC).
This allows the TC to monitor HikariCP/Druid pool metrics in real time for observability and diagnostics.

Key changes include:

  • Added sequenceNumber and ConnectionPoolInfo fields to HeartbeatMessage
  • Introduced createHeartbeatMessage() in AbstractNettyRemotingClient for extensible heartbeat construction
  • Updated RmNettyRemotingClient to report connection pool metrics every 30 seconds
  • Updated ServerHeartbeatProcessor to receive and cache client pool info
  • Exposed retrieval APIs for monitoring via ConnectionPoolInfoCache

Ⅱ. Does this pull request fix one issue?

No specific issue is closed, but this PR contributes to the ongoing connection-pool monitoring feature (GSoC).

Ⅲ. Why don't you add test cases (unit test/integration test)?

The functionality mainly extends the existing heartbeat mechanism and introduces a cache for runtime metrics.
Follow-up PRs will include integration tests once frontend visualization and gRPC reporting are completed.

Ⅳ. Describe how to verify it

  1. Start Seata server and a sample RM application (e.g., Seata-sample).
  2. Observe heartbeat packets via debug log:
    • Client periodically sends HeartbeatMessage containing ConnectionPoolInfo.
    • Server receives and logs updated metrics in ServerHeartbeatProcessor.
  3. Use getAllPoolInfo() API to verify cached client pool information is updated correctly.

Ⅴ. Special notes for reviews

  • This PR is part of GSoC 2025 Seata connection-pool monitoring and configuration project.
  • Following PR will include the controller in seata-server.

import org.apache.seata.core.protocol.MessageType;
import org.apache.seata.core.protocol.RegisterRMRequest;
import org.apache.seata.core.protocol.RegisterRMResponse;
import org.apache.seata.core.protocol.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is best not to use the import *.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestions. I will fix that.

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