tarantool / tarantool

Get your data in RAM. Get compute close to data. Enjoy the performance.
https://www.tarantool.io
Other
3.43k stars 380 forks source link

Choose an allocator for memtx in box.cfg #5419

Closed alyapunov closed 3 years ago

alyapunov commented 4 years ago

Slab allocator, which is used for allocation tuples, has a certain disadvantage - it tends to unresolvable fragmentation on certain workloads (size migration).

Provide an option in box.cfg that allows to choose some other allocator for memtx tuples. At least it must be simple allocator like hpall (there must a branch). At most - log structurea allocator (like lsall, also on the same branch).

There's also an idea to make that option per space, but I'm not sure.

filonenko-mikhail commented 4 years ago

This day I prefer such option per space, to enable it only for spaces with some array data at field. These are spaces with:

EvgenyMekhanik commented 3 years ago

After discussion with @lyapunov and @Korablev77, we decided the following:

  1. The allocator class should look like this:
    class Allocator {
    public:
         static inline void* alloc(size_t size);
         static inline void  free(void *ptr, size);
         static inline void  create(/* specific for this allocator arguments */);
         static inline void destroy(void);
         static inline void stats(struct allocator_stats *stats);
    private:
         /* specific for allocator private static members */
    };
  2. There are several methods for getting allocator statistic:
    • box.slab.stats for small allocator custom statistic
    • box.system.stats for system allocator custom statistic
    • box.slab.info (deprecated) for common allocators statistic
    • box.alloc.info same as previous, but new recommended method.
  3. Delayed free mode removed from allocator.