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

storage_db set small values (<=64k) operation benchmark #156

Closed danielealbano closed 2 years ago

danielealbano commented 2 years ago

This PR contains a number of changes to add an ad-hoc benchmark for the storage_db set small values (<=64k) operation.

In most of the cases cachegrand will be used to store values that are smaller than 64kb therefore makes sense to have an ad-hoc hot-path and an ad-hoc benchmark to track its performances.

The PR also contains some minor changes to better improve incorrect spinlock unlocking, sacrificing the flags in the spinlock struct, it was used only in the tests.

The PR adds a new mechanism to detect incorrect free or internal incorrect allocations, it's not 100% perfect but it's good enough to catch the vast majority of the problems (e.g. trying to free a pointer that is a few bytes off the actual address will be caught, previously the memory would have been freed anyway because the math behind the slab allocator uses the modulo operation to calculate which slot of memory has to be freed).

Among the minor things:

codecov[bot] commented 2 years ago

Codecov Report

Merging #156 (45d16c6) into main (40e43cd) will decrease coverage by 0.48%. The diff coverage is 30.90%.

@@            Coverage Diff             @@
##             main     #156      +/-   ##
==========================================
- Coverage   78.10%   77.62%   -0.49%     
==========================================
  Files          92       92              
  Lines        6130     6163      +33     
==========================================
- Hits         4788     4784       -4     
- Misses       1342     1379      +37     
Impacted Files Coverage Δ
src/log/log_debug.c 67.56% <0.00%> (-1.88%) :arrow_down:
src/storage/db/storage_db.c 44.22% <0.00%> (-4.27%) :arrow_down:
src/slab_allocator.c 98.16% <100.00%> (+0.08%) :arrow_up:
src/spinlock.c 96.15% <100.00%> (-3.85%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 40e43cd...45d16c6. Read the comment docs.