Open Alice52 opened 4 years ago
set prefech_count
to guarantee the theoretical maximum throughput
multiple consumers
// handle connection issue
ExecutorService es = Executors.newFixedThreadPool(20);
Connection conn = factory.newConnection(es);
multiple thread
bulk ACK
启用Prefetch count设置; 先1个消费者,1次只接收1条,处理完毕后再传输下一条,这样可以避免并发冲突和消息顺序问题; 如果消费速度不满足要求,则1次接收多条,按接收顺序处理; 如果消费速度还是不满足要求,则1次接收多条,并行处理; 如果消费速度还是不满足要求,则启动多个消费者,并行处理。 如果消费速度还是不满足要求,改需求,或者换别的中间件。
image v2
es-elasticsearch
service will handle data sync.ec-product
servicees-job-queue
, and immediately trigger enqueue is es-immediately-queue
ec-product
service
1. go-mysql-transfer
2. code[es data sync issue]
diagram:
image v1