algorand / algorand/conduit

Replace `sirupsen/logrus` with a more performant logger

オープン
#131 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
Team Lamprey
主要言語
Go
スター
44
フォーク
34
PR マージ指標
30日以内にマージされた PR はありません

説明

## Problem

In working on #128 , I ran some performance tests and noticed that log-level had a significant impact. logrus has been observed to be slow in go-algorand and there is an internal issue (2479) to replace it and [a poc branch](https://github.com/excalq/go-algorand/tree/excalq/logging-refactor-zerolog) using [zerolog](https://github.com/rs/zerolog).

### Problematic experiment
Using the [Justfile command](https://gist.github.com/tzaffi/0b456532a7d6511ede7fe1bdae241e75#file-justfile-L471)

```sh
❯ just conduit-bootstrap-and-go 300
```
to bootstrap testnet and run a postgresql exporter against it for 300 seconds. I ran it a number of times against both the original pipeline and the new one. Here are the experimental results:

| Log Level | Reps | Original rounds/300 sec (logs/round) | Pipelining rounds/300 sec (logs/round) | Pipelining v Original (%) |
|-----------|------|-----|--------------------------|---------------------------|
| TRACE | 3 | 3718 (7.0) | 3509 (14.0) | -5.6% |
| INFO | 2 | 4578.5 (3.0) | 4423.5 (3.0) | -3.4% |

So comparing the results within each _column_ we can see:
* 19% performance decline in the _Original_ algorithm when going from 3 → 7 logs/round
* 21% performance decline in the _Pipelining_ algorithm when going from 3 → 14 logs/round

The sample was very noisy but it looks like each log per round is costing around 1-5 % hit in terms of performance.

## Action Items
1. A POC PR which let's us validate the performance implications of swapping out logrus for zerolog
2. Decide if we want to allow "plug and play" logger capability (we have heard one community member make this suggestion)
3. Switch all logs in conduit to the new logger (possibly via an interface if we opt for the "plug and play" approach)

## More links
* [cce's noop logger](https://github.com/algorand/go-algorand/compare/master...cce:go-algorand:noopLogger)
* [Will's epic on go-algorand](https://github.com/algorand/go-algorand/issues/5505)
* Google's intro of [go 1.21 structured logging](https://www.youtube.com/watch?v=gd_Vyb5vEw0&ab_channel=GoogleOpenSource) and a nice overview of logging in go

## Dependencies

None

## Urgency

Medium - as we're currently working on improving Conduit's performance, this seems like a useful avenue to persue.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。