borisermakof / serilog-sinks-fluentd

A Sink that writes logs into Fluentd
Apache License 2.0
20 stars 31 forks source link

Change MsgPack.Cli to MessagePack for memory leak and performance problems #23

Open liona-k-tanaka opened 2 years ago

liona-k-tanaka commented 2 years ago

This PR fixes the following problems:

  1. 22

  2. CPU Usage 100% for a while after massive log outputted.

This is our servers memory usages before and after this commit (fixed in 01/21). serilog-sinks-fluentd v0.4.0 has memory leak problem in serialization. But I couldn't fix by the solution in Issue #22. Finally, I changed serialization library from MsgPack.Cli to MessagePack for C# and confirmed the memory leak is fixed. memory_usages_before_and_after_memory_leak_fixed

In addition, I also fixed the performance problem because MessagePack for C# said "It is 10x faster than MsgPack-Cli".

Attention, MessagePack for C# is not compatible 100% for MsgPack-Cli. It need to change TargetFramework. And it may convert enum in logEvent.Properties to int instead of string. In our case it is no problem. But I don't know in your case.