Cassandra 中的本地传输请求

Native Transport Requests in Cassandra

我使用这个 link 得到了一些关于 Cassandra 本地传输请求的观点:

据我了解,我在 Cassandra 中执行的任何查询都是本机传输请求。

我经常在 Cassandra 中收到 Request Timed Out 错误,我在 Cassandra debug log 中观察到以下日志,以及使用 nodetool tpstats

/var/log/cassandra# nodetool tpstats
Pool Name                    Active   Pending      Completed   Blocked  All time blocked
MutationStage                     0         0      186933949         0                 0
ViewMutationStage                 0         0              0         0                 0
ReadStage                         0         0      781880580         0                 0
RequestResponseStage              0         0        5783147         0                 0
ReadRepairStage                   0         0              0         0                 0
CounterMutationStage              0         0       14430168         0                 0
MiscStage                         0         0              0         0                 0
CompactionExecutor                0         0         366708         0                 0
MemtableReclaimMemory             0         0            788         0                 0
PendingRangeCalculator            0         0              1         0                 0
GossipStage                       0         0              0         0                 0
SecondaryIndexManagement          0         0              0         0                 0
HintsDispatcher                   0         0              0         0                 0
MigrationStage                    0         0              0         0                 0
MemtablePostFlush                 0         0            799         0                 0
ValidationExecutor                0         0              0         0                 0
Sampler                           0         0              0         0                 0
MemtableFlushWriter               0         0            788         0                 0
InternalResponseStage             0         0              0         0                 0
AntiEntropyStage                  0         0              0         0                 0
CacheCleanupExecutor              0         0              0         0                 0
Native-Transport-Requests         0         0      477629331         0           1063468

Message type           Dropped
READ                         0
RANGE_SLICE                  0
_TRACE                       0
HINT                         0
MUTATION                     0
COUNTER_MUTATION             0
BATCH_STORE                  0
BATCH_REMOVE                 0
REQUEST_RESPONSE             0
PAGED_RANGE                  0
READ_REPAIR                  0

1) All time blocked 状态是什么?
2) 这个值是什么:1063468 表示什么?危害有多大?
3) 如何调优?

每个请求在被移交给 read/mutation 阶段之前都由 NTR 阶段处理,但它在等待完成时仍然阻塞。为了防止超载,该阶段开始阻止将任务添加到其队列以向客户端施加背压。每次请求被阻止时,all time blocked 计数器都会增加。因此 1063468 请求曾一度被阻止一段时间,因为必须备份许多请求。

在应用程序出现查询高峰的情况下,这种阻止是不必要的,并且可能会导致问题,因此您可以使用 -Dcassandra.max_queued_native_transport_requests=4096(默认 128)之类的东西来增加此队列限制。您也可以在客户端限制请求,但我会先尝试增加队列大小。

也可能有一些特别慢的请求阻塞了您的系统。如果您有监控设置,请查看高百分比 read/write 协调器延迟。您也可以使用 nodetool proxyhistograms。您的数据模型或查询中可能存在某些问题。