Axon 参考指南
  • 介绍
  • 架构概览
    • DDD & CQRS 概念
    • 事件溯源
    • 事件驱动的微服务
  • Axon Server
  • 发行说明
    • Axon Framework
      • Major Releases
      • Minor Releases
    • Axon Server
      • Major Releases
      • Minor Releases Standard Edition
      • Minor Releases Enterprise Edition
    • Axon Framework Extensions
      • AMQP
        • Major Releases
      • CDI
        • Major Releases
      • JGroups
        • Major Releases
      • Kafka
        • Major Releases
        • Minor Releases
      • Kotlin
        • Experimental Releases
      • Mongo
        • Major Releases
        • Minor Releases
      • Reactor
        • Major Releases
        • Minor Releases
      • Spring Cloud
        • Major Releases
        • Minor Releases
      • Tracing
        • Major Releases
        • Minor Releases
  • Getting Started
    • 快速开始
  • Axon Framework
    • 介绍
    • 消息传递概念
      • 消息剖析
      • 消息关联
      • 消息拦截
      • 支持带注解的处理程序
      • 异常处理
      • 工作单元
    • 命令
      • 建模
        • 聚合
        • 多实体聚合
        • 聚合状态存储
        • 从另一个聚合创建聚合
        • 聚合多态性
        • 解决冲突
      • 命令调度器
      • 命令处理程序
      • 基础设施
      • 配置
    • 事件
      • 事件调度器
      • 事件处理程序
      • 事件处理器
        • 订阅事件处理器
        • 流式事件处理器
      • 事件总线和事件存储
      • 事件版本控制
    • 查询
      • 查询处理
      • 查询调度器
      • 查询处理程序
      • 实现
      • 配置
    • 长时处理过程(Sagas)
      • 实现
      • 关联
      • 基础设施
    • Deadlines
      • Deadline Managers
      • Event Schedulers
    • 测试
      • 命令 / 事件
      • 长时处理过程(Sagas)
    • 序列化
    • 调整
      • 事件快照
      • 事件处理
      • 命令处理
    • 监控和指标
    • Spring Boot 集成
    • 模块
  • Axon Server
    • 介绍
    • 安装
      • 本地安装
        • Axon Server SE
        • Axon Server EE
      • Docker / K8s
        • Axon Server SE
        • Axon Server EE
    • 管理
      • 配置
        • System Properties
        • Command Line Interface
        • REST API
        • GRPC API
      • Monitoring
        • Actuator Endpoints
        • gRPC Metrics
        • Heartbeat Monitoring
      • Clusters
      • Replication Groups
      • Multi-Context
      • Tagging
      • Backup and Messaging-only Nodes
      • Backups
      • Recovery
      • Plugins
      • Error Codes
    • 安全
      • SSL
      • 访问控制
      • 访问控制 - 标准版
      • 访问控制 - 企业版
      • 访问控制 - 客户端应用程序
      • 访问控制 - 命令行
      • 访问控制 - REST API
      • 访问控制 - LDAP
      • 访问控制 - OAuth 2.0
    • 性能
      • 事件段
      • 流量控制
    • 迁移
      • Standard to Enterprise Edition
      • Non-Axon Server to Axon Server
  • Extensions
    • Spring AMQP
    • JGroups
    • Kafka
    • Kotlin
    • Mongo
    • Reactor
      • Reactor Gateways
    • Spring Cloud
    • Tracing
  • Appendices
    • A. RDBMS Tuning
    • B. Message Handler Tuning
      • 参数解析器
      • 处理程序增强
    • C. 元数据注解
    • D. 标识符生成
    • E. Axon Server Query Language
由 GitBook 提供支持
在本页
  1. Axon Server
  2. 性能

流量控制

Flow Control

Flow control is the process of managing the rate of data transmission between two nodes to prevent a fast sender from overwhelming a slow receiver.

In the messaging platform flow control is possible both between the messaging platform and the message handlers, and between the nodes in the messaging platform cluster.

Messaging Platform - Messaging Handler:

The client (i.e. the Axon Application) needs to set the following properties to configure flow control:

  • axon.axonserver.initial-nr-of-permits [1000] - number of messages that the server can initially send to client.

  • axon.axonserver.nr-of-new-permits [500] - additional number of messages that the server can send to client.

  • axon.axonserver.new-permits-threshold [500] - when client reaches this threshold in remaining messages, it sends a request with additional number of messages to receive.

Axon Server Nodes:

Set the following properties to control 'list aggregate events' prefetch rate, per aggregate and per segment:

  • axoniq.axonserver.event.aggregate.prefetch [5] - Ensures that backpressure signals from clients are split into batches. The initial request amount is {prefetch}*5, and subsequent (or replenishing) request amount is {prefetch}

  • axoniq.axonserver.event.events-per-segment-prefetch [10] - the maximum prefetched events from each opened event segment (max two opened segments in parallel)

Set the following properties to set flow control on the synchronization between nodes in an Axon Server cluster:

  • axoniq.axonserver.commandFlowControl.initial-nr-of-permits [10000] - number of messages that the master can initially send to replica.

  • axoniq.axonserver.commandFlowControl.nr-of-new-permits [5000] - additional number of messages that the master can send to replica.

  • axoniq.axonserver.commandFlowControl.new-permits-threshold [5000] - when replica reaches this threshold in remaining messages, it sends a request with additional number of messages to receive.

  • axoniq.axonserver.queryFlowControl.initial-nr-of-permits [10000] - number of messages that the master can initially send to replica.

  • axoniq.axonserver.queryFlowControl.nr-of-new-permits [5000] - additional number of messages that the master can send to replica.

  • axoniq.axonserver.queryFlowControl.new-permits-threshold [5000] - when replica reaches this threshold in remaining messages, it sends a request with additional number of messages to receive.

Streaming query

As a result, backpressure will not behave intuitively and will not propagate exact request signals from consumer to producer. HTTP/2 and Netty flow control have internal buffers based on message size. In turn, Axon Framework and Axon Server prefetch messages into internal buffers based on message count. The result is that the producer will send a number of messages until it fills all the buffers. Only then will backpressure kick in.

Hop to hop

The backpressure signal is propagated per-hop. This approach makes it not an end-to-end connection that allows intermediate Axon Server instances to handle backpressure between two connections and pre-fetch additional messages to increase overall performance.

It's important to note that similar to backpressure, the cancellation signal is also per hop. This means it's propagated over the network to Axon Server and then to the producer. This solution will thus introduce some latency in the stream cancellation. Even though there is potential latency involved in cancellation, any messages produced after the consumer signaled cancellation will be ignored.

上一页事件段下一页迁移

最后更新于2年前

Flow control and stream cancellation features are only available with Axon Server 4.6.0 and up. When streaming queries are used with Axon Server versions before 4.6.0, it will work although without the following essential features. Under the hood, backpressure does Hop to Hop signal propagation (see below) and inherits gRPC's .

HTTP2-based backpressure model