【问题标题】:CounterMutationStage and ViewMutationStage metrics are missing in Cassandra 4.0Cassandra 4.0 中缺少 CounterMutationStage 和 ViewMutationStage 指标
【发布时间】:2021-06-15 11:34:12
【问题描述】:

在 Cassandra 4.0 上调用 nodetool tpstats 时,这是我得到的 nodetool result screenshot

但没有找到 CounterMutationStage 和 ViewMutationStage。他们在哪里?

【问题讨论】:

    标签: cassandra jmx nodetool cassandra-4.0


    【解决方案1】:

    这些指标仍然存在。但问题是他们“懒惰地”公开他们的数据。这基本上意味着,当值为零时,它们根本不会显示。一旦您开始写入计数器或视图,这些指标就会执行它们的“延迟初始化”,然后才会公开它们。我使用 Cassandra 4.0 beta4 对此进行了测试。

    运行基线nodetool tpstats | head -n 4

    Pool Name                    Active Pending Completed Blocked All time blocked
    MutationStage                0      0       1         0       0
    ReadStage                    0      0       27        0       0
    CompactionExecutor           0      0       41        0       0
    

    接下来,我将创建一个简单的计数器表。

    CREATE TABLE games_popularity (game text PRIMARY KEY, popularity counter);
    

    我将计数器增加几次并SELECT

    aploetz@cqlsh> SELECT * FROM *.games_popularity ;
    
     game           | popularity
    ----------------+------------
     Cyberpunk 2077 |          3
    
    (1 rows)
    

    现在重新运行nodetool tpstats | head -n 4 确实显示CounterMutationStage

    Pool Name                    Active Pending Completed Blocked All time blocked
    MutationStage                0      0       12        0       0
    CounterMutationStage         0      0       3         0       0
    ReadStage                    0      0       96        0       0
    

    请注意,在 4.0 中,这些指标也暴露在 system_view.thread_pools 虚拟表中,您可以使用 SELECT * FROM system_views.thread_pools; 查看。

    【讨论】:

    • G'day 伙计,非常感谢您的回答!
    • 我受到了您对 CounterMutationStage 度量方法的启发,因此我对物化视图进行了一些操作以获得 ViewMutationCount:创建基表 -> 基于基表创建物化视图表 -> 插入一些基表中的表->从视图表中选择*->更新基表中的一些数据->从视图表中选择*->从基表中删除一些数据->从视图表中选择*但我仍然不能请参阅“nodetool tpstats”中的“ViewMutationStage”指标,您认为是什么?非常感谢!
    【解决方案2】:

    感谢 Cassandra 开发人员所做的出色工作,指标现已延迟初始化以提高性能。

    “唤醒”所有惰性指标的最佳方法是:

    nodetool getconcurrency
    

    【讨论】:

      最近更新 更多