Skip to content

Conversation

@Yukei7
Copy link
Contributor

@Yukei7 Yukei7 commented Oct 17, 2025

GCInspector should use different thresholds on GC events

patch by Yuqi Yan; reviewed by TBD for CASSANDRA-20980

The Cassandra Jira

logger.info(sb.toString());
else if (logger.isTraceEnabled())
logger.trace(sb.toString());
// TODO: trigger StatusLogger if concurrent phases take too long?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding the TODO, yes, I think it makes sense to do a symmetric logic: too long GC can steal some computation resources from request processing and it maybe helpful to flush stats to see a possible impact.
Note: the threshold for status logging should be correspondent (based on concurrent phase log thresholds)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be this comment removed as I see this patch contains StatusLogger.log already?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have it for non-concurrent branch only, so it is actual for the current branch with a concurrent threshold logic

@netudima
Copy link
Contributor

@Yukei7 could you please clarify have you tried to test the logic e2e manually (by running a Cassandra node built from the branch using ZGC or Shenandoah GC)? I understand that an automatic test would take too much efforts to build, so the question is only about a manual check to ensure that e2e works in the expected way.


public void setGcConcurrentPhaseWarnThresholdInMs(int threshold)
{
long gcConcurrentPhaseLogThresholdInMs = getGcConcurrentPhaseLogThresholdInMs();
Copy link
Contributor

@smiklosovic smiklosovic Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can move the resolution of this after the first "if". I that throws you have called this unnecessarily.

You have already done it like that in setGcConcurrentPhaseLogThresholdInMs

return DatabaseDescriptor.getGCConcurrentPhaseLogThreshold();
}

public void setGcConcurrentPhaseLogThresholdInMs(int threshold)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that what you did here just follows the style which was already there and there is nothing wrong with it as such but I just wonder if we could not move the logic of this into DD's method and this one would just call it. I get that the methods need to be here because we are exposing them in MBean but the logic itself might be just moved to DD, no?

Because if somebody every calls DD methods, there is no validation. But it is just here. So everybody has to go through this method to get the validation. If we moved it to DD then it would be validated every time, regardless from where it is called.

DD currently also contains methods which have some basic validation around its parameters so ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also as I understand it .... what happens when you put into yaml logically invalid values and you start the node? because the validation occurs only when you call mbean methods. If we want to be sure that what we started the node with makes sense already then it would need to be validated in DatabaseDesciptor.applySimpleConfig that is called as part of node startup and validated there so we are sure it is all valid already

public void ensureWarnGreaterThanLog()
{
gcInspector.setGcWarnThresholdInMs(gcInspector.getGcLogThresholdInMs());
try
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better style is to use Assertions.assertThrownBy

assertEquals(1000, gcInspector.getGcConcurrentPhaseLogThresholdInMs());
gcInspector.setGcConcurrentPhaseWarnThresholdInMs(2000);
assertEquals(2000, gcInspector.getGcConcurrentPhaseWarnThresholdInMs());
try
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assertions.assertThrownBy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants