danielealbano / cachegrand

cachegrand - a modern data ingestion, processing and serving platform built for today's hardware
BSD 3-Clause "New" or "Revised" License
975 stars 34 forks source link

Bug fix perf regression #322

Closed danielealbano closed 1 year ago

danielealbano commented 1 year ago

This PR fixes a bug in FFMA that has caused a massive performance regression (137k ops x core on my dev machine to ~9k ops x core).

The hugepage cache was never returning the freed hugepages to the system therefore this problem wasn't visibile but FFMA, to reduce memory consumption, always returns the freed regions. In case there are allocations and frees at the beginning of a region this gets returned straight away forcing FFMA to do a lot of extra re-initialization work!

To avoid this issue simply keep at least 1 region available in FFMA to amortize the initialization cost.

Additionally, this PR introduces a few minor fixes and performance improvements moving some of the heavily used functions to be statically inlined for better performances.