模式:主从同步异步刷盘,TransientStorePool不开启时生产rt不到2ms,开启后>100ms
机器:32g内存 -Xms16g -Xmx16g -Xmn8g
试试把commitIntervalCommitLog,commitCommitLogThoroughInterval这两个参数改到10ms以下
现在使用的时默认参数,我试试
修改参数不行,你们有开启TransientStorePool这个吗?参数发下参考下
压1k的消息时间就短,512B时间就长,而且时主从的同步时间变长
我也有相同问题,经过定位发现是代码中同步slave花费了大量时间
日志:
WARN GroupTransferService - transfer messsage to slave timeout,
定位时发现在HAService#run中selector.select(1000)花费了大量时间,大概200ms
public void run() {
log.info(this.getServiceName() + " service started");
while (!this.isStopped()) {
try {
if (this.connectMaster()) {
if (this.isTimeToReportOffset()) {
boolean result = this.reportSlaveMaxOffset(this.currentReportedOffset);
if (!result) {
this.closeMaster();
}
}
this.selector.select(1000);
boolean ok = this.processReadEvent();
if (!ok) {
this.closeMaster();
}
if (!reportSlaveMaxOffsetPlus()) {
continue;
}
long interval =
HAService.this.getDefaultMessageStore().getSystemClock().now()
- this.lastWriteTimestamp;
if (interval > HAService.this.getDefaultMessageStore().getMessageStoreConfig()
.getHaHousekeepingInterval()) {
log.warn("HAClient, housekeeping, found this connection[" + this.masterAddress
+ "] expired, " + interval);
this.closeMaster();
log.warn("HAClient, master not response some time, so close connection");
}
} else {
this.waitForRunning(1000 * 5);
}
} catch (Exception e) {
log.warn(this.getServiceName() + " service has exception. ", e);
this.waitForRunning(1000 * 5);
}
}
log.info(this.getServiceName() + " service end");
}
我怀疑是系统内核参数问题,收集了开启和关闭transientStorePoolEnable时的状态
transientStorePoolEnable = true
11时18分25秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时18分26秒 0.00 4068.00 8647.00 0.00 7156.00 0.00 0.00 0.00 0.00
11时18分26秒 proc/s cswch/s
11时18分27秒 19.00 22479.00
11时18分26秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时18分27秒 0.00 3420.00 64673.00 0.00 45164.00 0.00 0.00 0.00 0.00
11时18分27秒 proc/s cswch/s
11时18分28秒 12.00 23995.00
11时18分27秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时18分28秒 0.00 3048.00 6196.00 0.00 6812.00 0.00 0.00 0.00 0.00
11时18分28秒 proc/s cswch/s
11时18分29秒 12.00 21797.00
transientStorePoolEnable = false
11时23分40秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时23分41秒 0.00 66632.00 8795.00 0.00 7296.00 0.00 0.00 0.00 0.00
11时23分41秒 proc/s cswch/s
11时23分42秒 12.00 916262.00
11时23分41秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时23分42秒 0.00 84568.00 9073.00 0.00 7501.00 0.00 0.00 0.00 0.00
11时23分42秒 proc/s cswch/s
11时23分43秒 19.00 769002.00
11时23分42秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时23分43秒 0.00 53676.00 48456.00 0.00 45444.00 0.00 0.00 0.00 0.00
11时23分43秒 proc/s cswch/s
11时23分44秒 15.00 760400.00
11时23分43秒 pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff
11时23分44秒 0.00 74184.00 8369.00 0.00 9110.00 0.00 0.00 0.00 0.00
11时23分44秒 proc/s cswch/s
11时23分45秒 12.00 861319.00
希望能解答我的问题
简单点描述,开启TransientStorePool后,master写入变成 先写堆外内存 ,然后批量commit到 FileChannel写入,而主从同步判断能同步到的消息是已经commit到FileChannel的消息,而消息由堆外内存commit到PageCache是有一定频率的,是受commitIntervalCommitLog,commitCommitLogThoroughInterval两个参数影响,默认值是200ms,所以你能看到消息大体都落在100ms-200ms之间。
简单点描述,开启TransientStorePool后,master写入变成 先写堆外内存 ,然后批量commit到 FileChannel写入,而主从同步判断能同步到的消息是已经commit到FileChannel的消息,而消息由堆外内存commit到PageCache是有一定频率的,是受commitIntervalCommitLog,commitCommitLogThoroughInterval两个参数影响,默认值是200ms,所以你能看到消息大体都落在100ms-200ms之间。
懂了,那么将commitIntervalCommitLog,commitCommitLogThoroughInterval调小,频繁的调教到FileChannel是否对系统产生其他影响
Most helpful comment
简单点描述,开启TransientStorePool后,master写入变成 先写堆外内存 ,然后批量commit到 FileChannel写入,而主从同步判断能同步到的消息是已经commit到FileChannel的消息,而消息由堆外内存commit到PageCache是有一定频率的,是受commitIntervalCommitLog,commitCommitLogThoroughInterval两个参数影响,默认值是200ms,所以你能看到消息大体都落在100ms-200ms之间。