Cassandra 批量准备语句大小警告

Cassandra batch prepared statement size warning

我在 cassandra 的 debug.log 中不断看到这个错误,

WARN  [SharedPool-Worker-2] 2018-05-16 08:33:48,585 BatchStatement.java:287 - Batch of prepared statements for [test, test1] is of size 6419, exceeding specified threshold of 5120 by 1299.

在这个

   where,
                    6419 - Input payload size (Batch)
                    5120 - Threshold size
                    1299 - Byte size above threshold value

所以根据 Cassandra 中的这张票,https://github.com/krasserm/akka-persistence-cassandra/issues/33 我看到这是由于输入负载大小的增加,所以我将 cassandra.yml 中的 commitlog_segment_size_in_mb 增加到 60mb 并且我们不再面临此警告。

这个警告有害吗?增加 commitlog_segment_size_in_mb 会影响性能吗?

commit_log_segment_size_in_mb 表示提交日志归档或时间点备份的块大小。这些仅在您在 commitlog_archiving.properties 文件中配置了 archive_command 或 restore_command 时才有效。 默认大小为 32mb。

根据专家 Apache Cassandra 管理书:

you must ensure that value of commitlog_segment_size_in_mb must be twice the value of max_mutation_size_in_kb.

你可以参考这个:

Mutation of 17076203 bytes is too large for the maxiumum size of 16777216

这与提交日志大小没有直接关系,我想知道为什么它的更改导致警告消失...

批量大小阈值由 batch_size_warn_threshold_in_kb 参数控制,默认为 5kb(5120 字节)。

您可以将此参数增加到更高的值,但您确实需要有充分的理由使用批处理 - 了解它们的使用上下文会很好...