Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: log4j overhead for inactive markers is too high #16921

Merged
merged 5 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions hedera-node/data/config/node-admin-keys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"0": "0aa8e21064c61eab86e2a9c164565b4e7a9a4146106e0a6cd03a8c395a110e92"
}

Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,16 @@
@NonNull final CandidateWitness candidateWitness,
@NonNull final String votingType,
final long diff) {
logger.info(
CONSENSUS_VOTING.getMarker(),
"Witness {} voted on {}. vote:{} type:{} diff:{}",
votingWitness,
candidateWitness.getWitness(),
votingWitness.getVote(candidateWitness),
votingType,
diff);
if (logger.isDebugEnabled(CONSENSUS_VOTING.getMarker())) {
logger.debug(
CONSENSUS_VOTING.getMarker(),

Check warning on line 664 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ConsensusImpl.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ConsensusImpl.java#L663-L664

Added lines #L663 - L664 were not covered by tests
"Witness {} voted on {}. vote:{} type:{} diff:{}",
votingWitness,
candidateWitness.getWitness(),
votingWitness.getVote(candidateWitness),

Check warning on line 668 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ConsensusImpl.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ConsensusImpl.java#L667-L668

Added lines #L667 - L668 were not covered by tests
votingType,
diff);

Check warning on line 670 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ConsensusImpl.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/ConsensusImpl.java#L670

Added line #L670 was not covered by tests
}
}

private boolean firstVote(@NonNull final EventImpl voting, @NonNull final EventImpl votedOn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,17 @@
this.decided = true;
this.famous = isFamous;

logger.info(
CONSENSUS_VOTING.getMarker(),
"Fame decided for {}, election round {} unknown fame: {} ",
witness,
witness.getRoundCreated(),
numUnknownFame.get());
if (logger.isDebugEnabled(CONSENSUS_VOTING.getMarker())) {
logger.debug(
CONSENSUS_VOTING.getMarker(),

Check warning on line 103 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/CandidateWitness.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/CandidateWitness.java#L102-L103

Added lines #L102 - L103 were not covered by tests
"Fame decided for {}, election round {} unknown fame: {} ",
witness,
witness.getRoundCreated(),
numUnknownFame.get());

Check warning on line 107 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/CandidateWitness.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/CandidateWitness.java#L106-L107

Added lines #L106 - L107 were not covered by tests

if (numUnknownFame.equalsInt(0)) {
logger.info(CONSENSUS_VOTING.getMarker(), "Fame decided for round {}", witness.getRoundCreated());
if (numUnknownFame.equalsInt(0)) {
logger.debug(CONSENSUS_VOTING.getMarker(), "Fame decided for round {}", witness.getRoundCreated());

Check warning on line 110 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/CandidateWitness.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/CandidateWitness.java#L110

Added line #L110 was not covered by tests
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@
* @param witness the witness being added
*/
public void addWitness(@NonNull final EventImpl witness) {
logger.info(
CONSENSUS_VOTING.getMarker(),
"Adding witness for election {}",
witness.getBaseEvent().getDescriptor());
if (logger.isDebugEnabled(CONSENSUS_VOTING.getMarker())) {
logger.debug(
CONSENSUS_VOTING.getMarker(),

Check warning on line 84 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/RoundElections.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/RoundElections.java#L83-L84

Added lines #L83 - L84 were not covered by tests
"Adding witness for election {}",
witness.getBaseEvent().getDescriptor());

Check warning on line 86 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/RoundElections.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/consensus/RoundElections.java#L86

Added line #L86 was not covered by tests
}
numUnknownFame.increment();
elections.add(new CandidateWitness(witness, numUnknownFame, elections.size()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@
logger.info(
SYNC_INFO.getMarker(),
"{} writing events done, wrote {} events",
connection::getDescription,
sendList::size);
connection.getDescription(),
sendList.size());

Check warning on line 425 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/ShadowgraphSynchronizer.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/ShadowgraphSynchronizer.java#L424-L425

Added lines #L424 - L425 were not covered by tests
logger.info(
SYNC_INFO.getMarker(),
"{} reading events done, read {} events",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,18 @@

connection.getDos().writeTipHashes(tipHashes);
connection.getDos().flush();
logger.info(
SYNC_INFO.getMarker(),
"{} sent event window: {}",
connection::getDescription,
eventWindow::toString);
logger.info(
SYNC_INFO.getMarker(),
"{} sent tips: {}",
connection::getDescription,
() -> SyncLogging.toShortShadows(tips));
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 94 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L93-L94

Added lines #L93 - L94 were not covered by tests
"{} sent event window: {}",
connection::getDescription,
eventWindow::toString);
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 99 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L96-L99

Added lines #L96 - L99 were not covered by tests
"{} sent tips: {}",
connection::getDescription,
() -> SyncLogging.toShortShadows(tips));

Check warning on line 102 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L101-L102

Added lines #L101 - L102 were not covered by tests
}
return null;
};
}
Expand All @@ -120,16 +122,18 @@

final List<Hash> tips = connection.getDis().readTipHashes(numberOfNodes);

logger.info(
SYNC_INFO.getMarker(),
"{} received event window: {}",
connection::getDescription,
eventWindow::toString);
logger.info(
SYNC_INFO.getMarker(),
"{} received tips: {}",
connection::getDescription,
() -> SyncLogging.toShortHashes(tips));
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 127 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L126-L127

Added lines #L126 - L127 were not covered by tests
"{} received event window: {}",
connection::getDescription,
eventWindow::toString);
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 132 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L129-L132

Added lines #L129 - L132 were not covered by tests
"{} received tips: {}",
connection::getDescription,
() -> SyncLogging.toShortHashes(tips));

Check warning on line 135 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L134-L135

Added lines #L134 - L135 were not covered by tests
}

return new TheirTipsAndEventWindow(eventWindow, tips);
};
Expand All @@ -148,11 +152,13 @@
return () -> {
connection.getDos().writeBooleanList(theirTipsIHave);
connection.getDos().flush();
logger.info(
SYNC_INFO.getMarker(),
"{} sent booleans: {}",
connection::getDescription,
() -> SyncLogging.toShortBooleans(theirTipsIHave));
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 157 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L156-L157

Added lines #L156 - L157 were not covered by tests
"{} sent booleans: {}",
connection::getDescription,
() -> SyncLogging.toShortBooleans(theirTipsIHave));

Check warning on line 160 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L159-L160

Added lines #L159 - L160 were not covered by tests
}
return null;
};
}
Expand All @@ -171,11 +177,13 @@
if (booleans == null) {
throw new SyncException(connection, "peer sent null booleans");
}
logger.info(
SYNC_INFO.getMarker(),
"{} received booleans: {}",
connection::getDescription,
() -> SyncLogging.toShortBooleans(booleans));
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 182 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L181-L182

Added lines #L181 - L182 were not covered by tests
"{} received booleans: {}",
connection::getDescription,
() -> SyncLogging.toShortBooleans(booleans));

Check warning on line 185 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L184-L185

Added lines #L184 - L185 were not covered by tests
}
return booleans;
};
}
Expand All @@ -199,23 +207,27 @@
final AtomicBoolean writeAborted,
final Duration syncKeepalivePeriod) {
return () -> {
logger.info(
SYNC_INFO.getMarker(),
"{} writing events start. send list size: {}",
connection.getDescription(),
events.size());
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 212 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L211-L212

Added lines #L211 - L212 were not covered by tests
"{} writing events start. send list size: {}",
connection.getDescription(),
events.size());

Check warning on line 215 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L214-L215

Added lines #L214 - L215 were not covered by tests
}
for (final PlatformEvent event : events) {
connection.getDos().writeByte(ByteConstants.COMM_EVENT_NEXT);
connection.getDos().writePbjRecord(event.getGossipEvent(), GossipEvent.PROTOBUF);
}
if (writeAborted.get()) {
logger.info(SYNC_INFO.getMarker(), "{} writing events aborted", connection.getDescription());
} else {
logger.info(
SYNC_INFO.getMarker(),
"{} writing events done, wrote {} events",
connection.getDescription(),
events.size());
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 226 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L225-L226

Added lines #L225 - L226 were not covered by tests
"{} writing events done, wrote {} events",
connection.getDescription(),
events.size());

Check warning on line 229 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L228-L229

Added lines #L228 - L229 were not covered by tests
}
connection.getDos().writeByte(ByteConstants.COMM_EVENT_DONE);
}
connection.getDos().flush();
Expand All @@ -232,7 +244,9 @@
connection.getDos().writeByte(ByteConstants.COMM_SYNC_DONE);
connection.getDos().flush();

logger.debug(SYNC_INFO.getMarker(), "{} sent COMM_SYNC_DONE", connection.getDescription());
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(SYNC_INFO.getMarker(), "{} sent COMM_SYNC_DONE", connection.getDescription());

Check warning on line 248 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L248

Added line #L248 was not covered by tests
}

// (ignored)
return null;
Expand Down Expand Up @@ -263,7 +277,9 @@
@NonNull final Duration maxSyncTime) {

return () -> {
logger.info(SYNC_INFO.getMarker(), "{} reading events start", connection.getDescription());
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(SYNC_INFO.getMarker(), "{} reading events start", connection.getDescription());

Check warning on line 281 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L281

Added line #L281 was not covered by tests
}
int eventsRead = 0;
try {
final long startTime = System.nanoTime();
Expand Down Expand Up @@ -299,11 +315,13 @@
eventsRead = Integer.MIN_VALUE;
}
case ByteConstants.COMM_EVENT_DONE -> {
logger.info(
SYNC_INFO.getMarker(),
"{} reading events done, read {} events",
connection.getDescription(),
eventsRead);
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 320 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L319-L320

Added lines #L319 - L320 were not covered by tests
"{} reading events done, read {} events",
connection.getDescription(),
eventsRead);

Check warning on line 323 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L322-L323

Added lines #L322 - L323 were not covered by tests
}
syncMetrics.eventsReceived(startTime, eventsRead);
// we are done reading event, tell the writer thread to send a COMM_SYNC_DONE
eventReadingDone.countDown();
Expand All @@ -313,14 +331,20 @@
// if they are still busy reading events
case ByteConstants.COMM_SYNC_ONGOING -> {
// peer is still reading events, waiting for them to finish
logger.debug(
SYNC_INFO.getMarker(),
"{} received COMM_SYNC_ONGOING",
connection.getDescription());
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 336 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L335-L336

Added lines #L335 - L336 were not covered by tests
"{} received COMM_SYNC_ONGOING",
connection.getDescription());

Check warning on line 338 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L338

Added line #L338 was not covered by tests
}
}
case ByteConstants.COMM_SYNC_DONE -> {
logger.debug(
SYNC_INFO.getMarker(), "{} received COMM_SYNC_DONE", connection.getDescription());
if (logger.isDebugEnabled(SYNC_INFO.getMarker())) {
logger.debug(
SYNC_INFO.getMarker(),

Check warning on line 344 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L343-L344

Added lines #L343 - L344 were not covered by tests
"{} received COMM_SYNC_DONE",
connection.getDescription());

Check warning on line 346 in platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java

View check run for this annotation

Codecov / codecov/patch

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/gossip/shadowgraph/SyncUtils.java#L346

Added line #L346 was not covered by tests
}
return eventsRead;
}
default -> throw new SyncException(
Expand Down