Skip to content

Don't pay vote Debug logging cost in normal operation #2847

@ValarDragon

Description

@ValarDragon

Feature Request

Summary

Currently we spend lots of RAM allocation in Debug logs across votes. Here are some profiles of a query serving full node in its operation over 1-2 hours. We see:

addVote's StringShort calls taking 5GB of allocation (compared to the state machines total 48GB):
Screenshot from 2024-04-18 20-55-22
These are both debug line calls:

Peerstate.setHasVote taking 15.4GB, this is entirely in debug logging:

ps.logger.Debug("setHasVote",
"peerH/R",
log.NewLazySprintf("%d/%d", ps.PRS.Height, ps.PRS.Round),
"H/R",
log.NewLazySprintf("%d/%d", height, round),
"type", voteType, "index", index)

Problem Definition

This is certainly adding notable load to the system, and its not even providing utility most of the time!

Proposal

I'm not sure what the most well abstracted way to do the logic for "if debug mode, run this log logic" is. Just wanted to point out that there is a lot were paying right now

Metadata

Metadata

Assignees

No one assigned

    Labels

    consensusenhancementNew feature or requestlogsAnything relating to logging

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions