NLog icon indicating copy to clipboard operation
NLog copied to clipboard

Remove LogEvent SequenceID or change to 64 bit ?

Open snakefoot opened this issue 3 years ago • 3 comments

Random thoughts after looking at #4139. And the overhead from synchronizing cpu-caches to atomically increment a counter that very few people uses, and unexpectedly can become negative after some days.

Lets say we have an application that handles 10.000 requests/sec. This application writes a single logevent for each request.

This means the application will write 36..000.000 logevents/hour. And 864.000.000 logevents/day.

Right now the SequenceID is an integer and can hold 2,147,483,647 events, before it becomes negative. So that is 3 days without restarts. Many applications often run 7 days without restarts.

Maybe the SequenceID-property should only increment when calling the propery-getter? (Skip on constructor)

Maybe https://github.com/NLog/NLog/wiki/SequenceId-layout-renderer should be replaced by https://github.com/NLog/NLog/wiki/Counter-layout-renderer ? (Merge into one)

snakefoot avatar Nov 05 '20 20:11 snakefoot

Maybe the SequenceID-property should only increment when calling the propery-getter? (Skip on constructor)

Sounds good for NLog 5!

304NotModified avatar Feb 27 '21 18:02 304NotModified

Sounds good for NLog 5!

Yes already implemented with #4247

But it only reduces the overhead. It doesn't really fix the issue with negative integer values

snakefoot avatar Feb 27 '21 18:02 snakefoot

Ow yes indeed. Well I guess we can close this one. Long is also nice, but not sure if needed

304NotModified avatar Feb 27 '21 22:02 304NotModified