mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
加上 if (logger.isDebugEnabled()) 防止message.toString每次都会被运行,message过大会卡cpu
This commit is contained in:
@@ -21,7 +21,7 @@ import com.alibaba.otter.canal.protocol.Message;
|
|||||||
*/
|
*/
|
||||||
public class CanalKafkaProducer {
|
public class CanalKafkaProducer {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(CanalKafkaProducer.class);
|
private static final Logger logger = LoggerFactory.getLogger(CanalKafkaProducer.class);
|
||||||
|
|
||||||
private Producer<String, Message> producer;
|
private Producer<String, Message> producer;
|
||||||
|
|
||||||
@@ -83,6 +83,8 @@ public class CanalKafkaProducer {
|
|||||||
record = new ProducerRecord<String, Message>(topic.getTopic(), message);
|
record = new ProducerRecord<String, Message>(topic.getTopic(), message);
|
||||||
}
|
}
|
||||||
producer.send(record);
|
producer.send(record);
|
||||||
logger.debug("send message to kafka topic: {} \n {}", topic.getTopic(), message.toString());
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug("send message to kafka topic: {} \n {}", topic.getTopic(), message.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ retries: 0
|
|||||||
batchSize: 16384
|
batchSize: 16384
|
||||||
lingerMs: 1
|
lingerMs: 1
|
||||||
bufferMemory: 33554432
|
bufferMemory: 33554432
|
||||||
# canal的批次大小,单位 k
|
# canal的批次大小,单位 k,量大建议改为1M
|
||||||
canalBatchSize: 50
|
canalBatchSize: 50
|
||||||
filterTransactionEntry: true
|
filterTransactionEntry: true
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ canalDestinations:
|
|||||||
partition:
|
partition:
|
||||||
# 一个destination可以对应多个topic
|
# 一个destination可以对应多个topic
|
||||||
# topics:
|
# topics:
|
||||||
# - topics: example
|
# - topic: example
|
||||||
# partition:
|
# partition:
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user