问题描述
在 Cassandra 4.0 上调用 nodetool tpstats
时,这是我得到的 nodetool result screenshot
但是没有找到 CounterMutationStage 和 ViewMutationStage。他们在哪里?
解决方法
那些指标仍然存在。但问题是他们“懒惰”地公开数据。这基本上意味着,当值为零时它们根本不会显示。一旦您开始写入计数器或视图,这些指标就会执行它们的“延迟初始化”,然后才会公开。我使用 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 stackoverflow.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;
查看。
感谢 Cassandra 开发人员所做的出色工作,现在可以延迟初始化指标以提高性能。
“唤醒”所有惰性指标的最佳方法是:
nodetool getconcurrency