Closed danielealbano closed 1 year ago
Patch coverage: 53.77
% and project coverage change: -0.50
:warning:
Comparison is base (
b151815
) 79.03% compared to head (9f1f01f
) 78.53%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This PR implements the multi database support in cachegrand, allowing cachegrand to have separated namespaces where to store data meanwhile sharing the database index.
Although this approach is different from what Redis does, it opens the doors to different scenarios, e.g. transactional operations across different namespaces will be possible because the indexes are shared.
This approach also will open the door to mapping specific database numbers to specific module configurations in the config file (currently not implemented), allowing to have more endpoint exposed with access to different databases (e.g. an endpoint with access to the db numbers from 0 to 15, and another, maybe in the future shared with memcache, from 16 to 64). Although internally the database number is an uint32, the configuration allows only up to UINT8_MAX (255) namespaces.
One of the biggest downsides of having to support multiple databases is having separated counters, one global and one per database. To avoid a performance loss, a number of optimizations have been implemented in the hashtable_spsc and it's now capable of getting the value associated with a key in ~1.09ns in average with the worst case being around ~1.30ns.
Here a bench run of hashtable-spsc-op-get
These amazing performances render almost null the impact of the extra counters.
The PR also introduces the SELECT command.
Although some tests have been implemented for the SELECT command to test, end-to-end, the process, it's necessary to implement further tests.
Closes #368 Closes #369