Skip to content

Conversation

@perctrix
Copy link

/kind feature

What this PR does / why we need it:

本PR实现了Halo的完整分布式部署功能,使系统能够在多实例环境中高效可靠地运行。这一功能从零开始构建,包含了所有必要组件和优化措施,具体包括:

  1. 核心分布式架构

    • 实现基于Redis的跨实例通信机制
    • 设计分布式缓存管理系统
    • 构建分布式调度框架
  2. 可靠消息传递

    • 实现RedisStream事件发布和订阅
    • 引入Outbox模式确保事务一致性
    • 完善错误处理和消息重试机制
  3. 分布式缓存同步

    • 设计缓存失效策略
    • 实现全量校验机制
    • 开发缓存预热功能
  4. 系统可观测性

    • 集成分布式健康检查功能
    • 添加关键性能指标监控
    • 支持分布式链路追踪
  5. 性能优化

    • 精细化Redis连接池配置
    • 并行化事件处理提高吞吐量
    • 批量差量更新减少资源消耗

这一功能使Halo突破了单实例部署的限制,能够满足大规模企业应用的需求,支持水平扩展和高可用部署,同时保持了系统的一致性和可靠性。

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

  1. 分布式功能通过halo.distributed.enabled=true配置激活,默认为禁用状态。
  2. 功能需要正确配置Redis,详细配置说明已在文档中提供。
  3. 实现了完整的错误处理和回退机制,确保系统在异常情况下的稳定性。
  4. 所有功能都经过了单实例和多实例环境的测试验证。
  5. 设计兼容现有API,用户不需要修改任何客户端代码。

Does this PR introduce a user-facing change?

feat: 实现完整的分布式部署功能支持
- 基于Redis的跨实例通信和事件分发
- 分布式缓存管理和同步机制
- 可靠消息传递与Outbox模式支持
- 分布式健康检查和可观测性能力
- 高性能连接池和并行处理优化

perctrix and others added 9 commits April 19, 2025 23:41
- Added DistributedEvent class to represent events for cross-instance notifications.
- Created OutboxEvent and OutboxEventRepository for storing and managing outbox events.
- Implemented OutboxService to handle saving and processing of outbox events.
- Developed OutboxProcessor to periodically publish unprocessed events to Redis Stream.
- Enhanced RedisStreamEventPublisher to publish DistributedEvents.
- Introduced RedisStreamManager for managing Redis Stream configurations and maintenance.
- Updated PostServiceImpl to save events to the outbox instead of directly publishing.
- Added FullDataChecksumTask for periodic data integrity checks across instances.
- Updated application.yaml with new configuration properties for outbox processing.
- Created schema-h2-outbox.sql for outbox_events table and integrated it into schema-h2.sql.
…ding message count

fix: Refactor FullDataChecksumTask to improve logging and use updated method for resource version
…t; refactor FullDataChecksumTask to return Mono.empty() and enhance IndexEndpoint with direct query parameter extraction
@CLAassistant
Copy link

CLAassistant commented Apr 21, 2025

CLA assistant check
All committers have signed the CLA.

@perctrix perctrix changed the title feat(distributed): 分布式部署性能与可靠性优化 feat(distributed): 分布式部署与性能优化 Apr 21, 2025
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Apr 22, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign guqing for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ruibaby
Copy link
Member

ruibaby commented Apr 22, 2025

感谢 @StevenChen16 参与贡献,在 Review 之前,请先移除这些不必要的改动。

image

@f2c-ci-robot f2c-ci-robot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 25, 2025
@f2c-ci-robot f2c-ci-robot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 25, 2025
@sonarqubecloud
Copy link

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

Hi @StevenChen16 , thank you for contribution!

针对分布式部署这种相对比较大的功能,建议先提交 Issue 并在社区进行充分讨论之后再进行实现。

非常抱歉我们无法 Review 并合并当前 PR。

@ruibaby
Copy link
Member

ruibaby commented May 6, 2025

感谢 @StevenChen16 的参与,但如 #7372 (review) 所述,通常 Halo 在进行较大特性的开发前,都需要经过 RFC 或者 issue 讨论实现方式,比如我们开发缩略图的完整过程:

所以此 PR 可能暂时不会合并。

@f2c-ci-robot f2c-ci-robot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 8, 2025
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented May 8, 2025

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@perctrix perctrix closed this May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants