Apusic文档中心
首页
  • 应用服务器 AAS
  • 负载均衡器 ALB
  • 分布式消息队列 ADMQ
  • 分布式缓存 AMDC
  • 分布式配置中心 ADCC
  • Java开发工具包软件 AJDK
  • 搜索引擎 ASE
  • 中间件云平台 ACP
  • 统一管理平台 AUMP
  • 云原生中间件管理 ACMP
  • DevOps平台 ADOP
  • 许可授权中心 ACLS
  • Copilot智能问答系统 ACS
  • 监控平台 AMP
  • 智能日志 AILP
  • 应用性能管理 AAPM
  • 智能告警 AAlarm
  • 金蝶Apusic AI 极光
  • 主数据管理 AMDM
  • 数据交换平台 ADXP
  • 企业服务总线 AESB
  • 数据智脑 ADPR
  • 服务治理 ASGP
  • 统一身份管理 AIDM
  • 标准模板
  • Markdown教程 (opens new window)
  • VuePress官方社区 (opens new window)
  • 帮助
贡献文档 (opens new window)
首页
  • 应用服务器 AAS
  • 负载均衡器 ALB
  • 分布式消息队列 ADMQ
  • 分布式缓存 AMDC
  • 分布式配置中心 ADCC
  • Java开发工具包软件 AJDK
  • 搜索引擎 ASE
  • 中间件云平台 ACP
  • 统一管理平台 AUMP
  • 云原生中间件管理 ACMP
  • DevOps平台 ADOP
  • 许可授权中心 ACLS
  • Copilot智能问答系统 ACS
  • 监控平台 AMP
  • 智能日志 AILP
  • 应用性能管理 AAPM
  • 智能告警 AAlarm
  • 金蝶Apusic AI 极光
  • 主数据管理 AMDM
  • 数据交换平台 ADXP
  • 企业服务总线 AESB
  • 数据智脑 ADPR
  • 服务治理 ASGP
  • 统一身份管理 AIDM
  • 标准模板
  • Markdown教程 (opens new window)
  • VuePress官方社区 (opens new window)
  • 帮助
贡献文档 (opens new window)
文档中心
  • 金蝶Apusic应用服务器

  • 金蝶Apusic负载均衡器

  • 金蝶Apusic分布式消息队列

    • 产品白皮书
    • Product Whitepaper
    • 產品白皮書
    • 产品更新说明
    • 统一管控台

    • V2.0.6(最新)

    • V2.0.6_for_kafka

    • V2.0.6_for_rabbitmq

    • V2.0.6_for_rocketmq

      • 产品简介
      • 功能与技术规格
      • 安装手册
      • 快速使用手册
      • 管控台用户手册
      • 消息引擎用户手册
      • 开发手册
      • 迁移手册
      • 运维手册
      • 性能优化手册
      • English

        • Product Introduction
        • Technical Specification
        • Installation Manual
        • Quick Start
        • Console User Manual
        • Core Engine User Manual
        • Development Manual
        • Migration Manual
        • Operations Manual
        • Performance Tuning
      • 繁體中文

    • V2.0.6_for_MQTT

    • V2.0.5

    • V2.0.4

    • V2.0.3

  • 金蝶Apusic分布式缓存

  • 金蝶Apusic分布式配置中心

  • 金蝶Apusic Java开发工具包软件

  • 金蝶Apusic全文检索

Performance Tuning

# Preface

This document introduces the best practices for performance optimization of Kingdee Apusic Distributed Message Queue for RocketMQ (Apusic Distributed Message Queue for RocketMQ, referred to as: ADMQ for RocketMQ), helping users fully leverage system performance.

# Target Audience

This document is applicable to IT information business leaders, R&D managers, software project managers, software architects, and operations engineers.

# Related Documents

To learn more about ADMQ for RocketMQ related information, please refer to the following ADMQ for RocketMQ product documentation set:

No. Document Description
1 Kingdee Apusic Distributed Message Queue for RocketMQ Quick Start Guide Briefly introduces how to quickly get started with ADMQ for RocketMQ.
2 Kingdee Apusic Distributed Message Queue for RocketMQ Installation Manual Details how to install ADMQ for RocketMQ on various operating systems, as well as starting and stopping ADMQ for RocketMQ services.
3 Kingdee Apusic Distributed Message Queue for RocketMQ Message Engine User Manual Details the use, configuration, and management of ADMQ for RocketMQ message engine related functions and supporting tools.
4 Kingdee Apusic Distributed Message Queue for RocketMQ Console User Manual Details the use and operation of ADMQ for RocketMQ console related functions.
5 Kingdee Apusic Distributed Message Queue for RocketMQ Development Manual Details the development of ADMQ for RocketMQ client applications based on various development languages.
6 Kingdee Apusic Distributed Message Queue for RocketMQ Migration Manual Details the migration from RocketMQ to ADMQ for RocketMQ.
7 Kingdee Apusic Distributed Message Queue for RocketMQ Operations Manual Details monitoring, operation, security hardening, and other operational instructions for ADMQ for RocketMQ.
8 Kingdee Apusic Distributed Message Queue for RocketMQ Performance Optimization Manual Details performance tuning instructions for ADMQ for RocketMQ.

# Technical Support

ADMQ for RocketMQ products provide comprehensive technical support services. You can obtain technical support through the following methods:

  • Website: www.apusic.com
  • Phone: 400-855-5800
  • Email: support@apusic.com
  • Kingdee Cloud Community: https://vip.kingdee.com/?productId=73&productLineId=14&lang=zh-CN

When you obtain technical support, please provide the following information:

  1. Your name

  2. Company information and contact details

  3. Operating system and its version

  4. Product version number

  5. Detailed logs, screenshots, etc. of exceptions and errors

# System-Level Optimization

# Operating System Optimization

# File Descriptors

# View current limit
ulimit -n

# Modify limit (/etc/security/limits.conf)
* soft nofile 65535
* hard nofile 65535
1
2
3
4
5
6

# Kernel Parameters

# /etc/sysctl.conf

# Increase port range
net.ipv4.ip_local_port_range = 1024 65535

# TCP connection optimization
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
net.core.somaxconn = 65535

# Memory optimization
vm.swappiness = 10
vm.dirty_ratio = 40
vm.dirty_background_ratio = 10

# Apply configuration
sysctl -p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# Disk Optimization

Optimization Item Suggestion
File System Use XFS file system
Mount Options noatime,nodiratime
Disk Scheduler Use noop or deadline
RAID Configuration Use RAID 10 or RAID 0
SSD Optimization Enable TRIM, reserve over-provisioning
# View disk scheduling algorithm
cat /sys/block/sda/queue/scheduler

# Set to deadline
echo deadline > /sys/block/sda/queue/scheduler

# Mount options (/etc/fstab)
/dev/sda1 /data/rocketmq xfs noatime,nodiratime 0 0
1
2
3
4
5
6
7
8

# Network Optimization

# Network buffer
net.core.rmem_max = 134217728
net.core.wmem_max = 134217728
net.ipv4.tcp_rmem = 4096 87380 134217728
net.ipv4.tcp_wmem = 4096 65536 134217728

# TCP optimization
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
1
2
3
4
5
6
7
8
9
10
11

# RocketMQ Configuration Optimization

# Broker Configuration

Parameter Default Recommended Description
sendMessageThreadPoolNums 1 CPU cores Number of send message threads
pullMessageThreadPoolNums 16+ Adjust based on load Number of pull message threads
queryMessageThreadPoolNums 8 Adjust based on load Number of query message threads
adminBrokerThreadPoolNums 16 Adjust based on load Number of admin operation threads
brokerRole ASYNC_MASTER SYNC_MASTER Broker role
flushDiskType ASYNC_FLUSH SYNC_FLUSH Flush disk mode
flushIntervalCommitLog 500ms Based on reliability requirements CommitLog flush interval
flushIntervalConsumeQueue 1000ms Based on reliability requirements ConsumeQueue flush interval
# broker.conf
sendMessageThreadPoolNums=16
pullMessageThreadPoolNums=16
brokerRole=SYNC_MASTER
flushDiskType=SYNC_FLUSH
flushIntervalCommitLog=500
flushIntervalConsumeQueue=1000
1
2
3
4
5
6
7

# Storage Configuration

Parameter Default Recommended Description
mapedFileSizeCommitLog 1GB 1GB CommitLog file size
mapedFileSizeConsumeQueue 300MB 300MB ConsumeQueue file size
flushCommitLogTimed false false Whether to flush disk periodically
deleteWhen 04 04 Time to delete expired files
fileReservedTime 72 Based on disk capacity File retention time (hours)
diskMaxUsedSpaceRatio 75 75 Maximum disk usage ratio
# broker.conf
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000000
deleteWhen=04
fileReservedTime=72
diskMaxUsedSpaceRatio=75
1
2
3
4
5
6

# JVM Configuration

# NameServer JVM

# bin/runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g"
JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m"
JAVA_OPT="${JAVA_OPT} -XX:G1ReservePercent=25"
JAVA_OPT="${JAVA_OPT} -XX:InitiatingHeapOccupancyPercent=30"
1
2
3
4
5

# Broker JVM

# bin/runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g"
JAVA_OPT="${JAVA_OPT} -XX:+UseG1GC -XX:G1HeapRegionSize=16m"
JAVA_OPT="${JAVA_OPT} -XX:G1ReservePercent=25"
JAVA_OPT="${JAVA_OPT} -XX:InitiatingHeapOccupancyPercent=30"
JAVA_OPT="${JAVA_OPT} -XX:MaxDirectMemorySize=4g"
1
2
3
4
5
6

# Client Optimization

# Producer Optimization

# Send Mode Selection

Send Mode Throughput Reliability Use Case
Synchronous Send Medium High Scenarios requiring confirmation
Asynchronous Send High Medium High throughput scenarios
One-way Send Very High Low Log collection, etc.
Batch Send Very High Medium High throughput scenarios

# Producer Parameters

DefaultMQProducer producer = new DefaultMQProducer("test-group");
producer.setNamesrvAddr("localhost:9876");

// Send timeout
producer.setSendMsgTimeout(3000);

// Message body compression threshold (compress if exceeded)
producer.setCompressMsgBodyOverHowmuch(1024 * 4);

// Maximum message size
producer.setMaxMessageSize(1024 * 1024 * 4);

// Retry count
producer.setRetryTimesWhenSendFailed(2);
producer.setRetryTimesWhenSendAsyncFailed(2);

// Whether to retry another Broker on internal send failure
producer.setRetryAnotherBrokerWhenNotStoreOK(false);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# Batch Send

List<Message> messages = new ArrayList<>();
for (int i = 0; i < 100; i++) {
    messages.add(new Message("batch-topic", "tag-a", ("msg-" + i).getBytes()));
}
// Batch send, single batch should not exceed 1MB
producer.send(messages);
1
2
3
4
5
6

# Consumer Optimization

# Consumer Thread Count

DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("test-group");
consumer.setNamesrvAddr("localhost:9876");

// Minimum consumer thread count
consumer.setConsumeThreadMin(20);

// Maximum consumer thread count
consumer.setConsumeThreadMax(64);

// Consumption timeout (minutes)
consumer.setConsumeTimeout(15);
1
2
3
4
5
6
7
8
9
10
11

# Consumption Batch Size

// Maximum number of messages per consumption
consumer.setConsumeMessageBatchMaxSize(10);

// Maximum number of messages per pull
consumer.setPullBatchSize(32);

// Pull interval (milliseconds)
consumer.setPullInterval(0);
1
2
3
4
5
6
7
8

# Consumption Offset Strategy

// Start consumption from the last offset
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);

// Start consumption from the first offset
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);

// Start consumption from a specified time
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_TIMESTAMP);
consumer.setConsumeTimestamp("20260101000000");
1
2
3
4
5
6
7
8
9

# Cluster Optimization

# Node Deployment Strategy

Deployment Strategy Description Use Case
Same Data Center Deployment All nodes in the same data center Low latency, high throughput
Cross Data Center Deployment Nodes distributed across different data centers High availability, disaster recovery
Heterogeneous Deployment Mix of different configuration nodes Cost optimization

# Master-Slave Replication Optimization

# Synchronous Replication vs Asynchronous Replication

Replication Mode Reliability Performance Use Case
Synchronous Replication High Low Strong consistency scenarios like financial transactions
Asynchronous Replication Medium High General business scenarios
# broker.conf
# Synchronous replication
brokerRole=SYNC_MASTER

# Asynchronous replication
brokerRole=ASYNC_MASTER
1
2
3
4
5
6

# Flush Strategy Optimization

# Synchronous Flush vs Asynchronous Flush

Flush Mode Reliability Performance Use Case
Synchronous Flush High Low Strong consistency scenarios
Asynchronous Flush Medium High General business scenarios
# broker.conf
# Synchronous flush
flushDiskType=SYNC_FLUSH

# Asynchronous flush
flushDiskType=ASYNC_FLUSH
1
2
3
4
5
6

# Topic Queue Count Optimization

Scenario Queue Count Suggestion
Low Throughput 4-8
Medium Throughput 8-16
High Throughput 16-32
Very High Throughput 32-64
# Specify queue count when creating Topic
bin/mqadmin updateTopic -n localhost:9876 -c DefaultCluster -t test-topic -r 16 -w 16
1
2

# Monitoring and Tuning

# Performance Metrics

Metric Healthy Range Optimization Suggestion
Broker TPS Based on hardware configuration Scale up or optimize producers
Consumption TPS Close to production TPS Add consumers or optimize consumption logic
Message Accumulation < 1 million Add consumers or optimize consumption logic
Disk Usage < 75% Scale up or clean expired messages
Memory Usage < 80% Increase memory or optimize JVM parameters
Consumption Lag < 1 second Optimize consumption logic or add consumers

# Performance Testing

# Test using benchmark tool
bin/benchmark.sh producer -n localhost:9876 -t test-topic -s 128 -w 16

# Parameter description
# -n: NameServer address
# -t: Topic name
# -s: Message size (bytes)
# -w: Concurrency count
1
2
3
4
5
6
7
8

# Bottleneck Analysis

  1. CPU Bottleneck: Insufficient send/consume threads, compression/decompression, serialization
  2. Memory Bottleneck: Frequent JVM GC, insufficient DirectBuffer
  3. Disk Bottleneck: Flush mode, insufficient disk I/O, file system performance
  4. Network Bottleneck: Cross-data center deployment, insufficient bandwidth, network latency

# Common Issue Optimization

# Message Accumulation Optimization

  1. Increase consumer count
  2. Optimize consumer processing logic
  3. Increase consumption thread count
  4. Use batch consumption
  5. Scale up Broker nodes

# Send Performance Optimization

  1. Use asynchronous sending
  2. Use batch sending
  3. Increase producer count
  4. Optimize message size
  5. Disable message tracing (if not needed)

# Consumption Lag Optimization

  1. Increase consumption thread count
  2. Optimize consumption logic
  3. Use concurrent consumption
  4. Scale up consumers
  5. Check for slow consumers

# Performance Optimization Checklist

# System Level

  • [ ] File descriptor limits have been adjusted
  • [ ] Kernel parameters have been optimized
  • [ ] Disk uses XFS file system
  • [ ] Network parameters have been optimized
  • [ ] System resources are sufficient (CPU, memory, disk)

# RocketMQ Configuration

  • [ ] Broker thread count set appropriately
  • [ ] Flush strategy selected based on business
  • [ ] Replication strategy selected based on business
  • [ ] File retention time set appropriately
  • [ ] JVM parameters have been optimized

# Client Optimization

  • [ ] Send mode selected appropriately
  • [ ] Consumption thread count set appropriately
  • [ ] Batch size set appropriately
  • [ ] Retry count set appropriately
  • [ ] Consumption offset strategy selected appropriately

# Cluster Optimization

  • [ ] Topic queue count set appropriately
  • [ ] Master-slave replication strategy selected appropriately
  • [ ] Flush strategy selected appropriately
  • [ ] Cluster scale meets business requirements
  • [ ] Node deployment strategy selected appropriately
编辑页面 (opens new window)
#Performance Optimization Manual

← Operations Manual 產品介紹→

  • 浅色模式