Skip to content

[Proposal] Memory performance optimization #9580

@xinyiZzz

Description

@xinyiZzz

Motivation

  1. High concurrent query performance is poor, among which Spin Lock in tcmalloc has a large CPU ratio;
  2. The cache utilization in PageCache, MemPool, and Vec Allocator needs to be further improved;
  3. Multiple memory allocators from Impala, ClickHouse, and Doris coexist, which leads to optimization difficulties;
    (Similar problems exist while turning on or off the vectorization engine)

Expected Return

  1. Unified memory allocator;
  2. More memory reuse;
  3. Improve cache hit rate and reduce cache size;
  4. Try to introduce other memory frameworks such as JeMalloc;
  5. Reduce additional costs such as mem tracker;

Optimization direction

  1. Stress testing on more test sets to find memory hotspots;
  1. Test the performance of multiple memory allocators currently existing in Doris in different scenarios, unify them;
  2. Try to introduce tests such as JeMalloc;

Unify memory allocator

Row execution engine memory allocator

From Impala:

image

More previous research: https://shimo.im/docs/DXvQPcqPH3TyR6pY

Vectorized execution engine memory allocator

From ClickHouse:

image

In the future

image

Things to do

  1. Arena is equivalent to MemPool, unify them;
  2. SystemAllocator is equivalent to CK Allocator, unify them, and consider memory alignment, consider the use of MMap and HugePage;
  3. Compare the performance of Malloc, ChunkAllocator, and MMap allocating memory with different lengths at different frequencies. Combine their strengths.
  4. When removing the line storage execution engine, remove BufferAllocator, BufferPool, and SubAllocator at the same time;
  5. Consider the implementation of spill disk.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions