Skip to content

Speedup EventBus.PublishEventTx  #2869

Open

Description

@ValarDragon

Feature Request

Summary

In a block sync of 5000 blocks on Osmosis mainnet, we see 23 seconds out of 1050 in EventBus.PublishEventTx (2.1% of the ApplyBlock time), this should likely also impact live syncing blocks as it affects ApplyBlock.

image

Most of this time is time that doesn't even need to be spent!

Proposal

  • First notice that we spend 10.4 seconds in zerologger.With which is only here! However in the function we pass it into here, that time is only used in Debug logs. So we should just refactor the API's to only pay that cost if we are in debug mode. We just need to refactor that API to pass the base logger in, and only do the With call as a LazyLogger I think, that also only gets called if we are in that error case.
  • The fmt.Sprintf call taking 3.5 seocnds here should be able to live in a cache, since there should be a small number of composite tags. Perhaps we add an LRU cache of size (say) 20000 to cache these?

We should be able to speed this up notably more beyond these two improvements, but figured it may be worth writing up these two and getting it deployed in benchmarks first

Activity

  1. added
    enhancement
    needs-triage
    on Apr 23, 2024
  2. added this to the 2024-Q2 milestone on Apr 29, 2024
  3. adizere commented on May 1, 2024

    @adizere
    Contributor

    closed by #2911

  4. moved this from Todo to Done in CometBFTon May 1, 2024
  5. ValarDragon commented on May 1, 2024

    @ValarDragon
    ContributorAuthor

    No we should re-open this, that PR only closed the first checkbox of this issue!

  6. reopened this on May 2, 2024
  7. andynog commented on May 2, 2024

    @andynog
    Contributor

    Re-opened as per @ValarDragon comment

  8. modified the milestones: 2024-Q2, 2024-Q3 on Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-triage

    Type

    No type

    Projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions