Skip to content

Memory management issues #300

Closed
Closed

Description

Hi everyone,

After update to the latest stable release 1.1.54127 we have got an issues with ClickHouse.
The point is that ClickHouse server started to eat all available RAM until it will be full then OOM come and kill it.
The behavior change could be clearly seen on Munin memory graph:
screenshot from 2017-01-04 17-40-24

I tried to make lower values to uncompressed_cache_size and mark_cache_size parameters but this didn't help, below our current ClickHouse config:
config.txt

Our server configuration:
RAM: 96G
OS: Centos 6.8
ClickHouse server running using Docker 1.12.2, inside Ubuntu 14.04.5 container.

What could be the reason of the issues?
Please let me know if you will need any additional information.

Activity

  1. alexey-milovidov commented on Jan 5, 2017

    @alexey-milovidov
    Member

    Please show graphs of following metrics:

    ClickHouse.Metrics.MemoryTracking
    ClickHouse.Metrics.MemoryTrackingInBackgroundProcessingPool
    ClickHouse.Metrics.Merge

  2. alexey-milovidov commented on Jan 5, 2017

    @alexey-milovidov
    Member

    Do these values grow with growing of total memory usage?

    Also, please provide result of
    SELECT * FROM system.merges
    query at some time after server startup.

    What kind of tables do you use?
    If you also provide structure of corresponding tables, it will help.

  3. alexey-milovidov commented on Jan 9, 2017

    @alexey-milovidov
    Member

    BTW what - symbol mean for this value?

    It means, that memory was freed in context of background job (like eviction of old data from cache), but was allocated in other context. Usually, this is fine.
    I had hypothesis, that memory usage is due to merges, but your data shows that this is not true.

  4. alexey-milovidov commented on Jan 9, 2017

    @alexey-milovidov
    Member

    I still cannot guess, why this issue happens.
    Try to isolate possible dependencies. For example, try to enable/disable some types of queries.
    Maybe, you could temporary disable queries from Merge table and leave other queries, and see what happens.

  5. alexey-milovidov commented on Jan 22, 2017

    @alexey-milovidov
    Member

    Please try to update to 54135.

  6. alexey-milovidov commented on Feb 9, 2017

    @alexey-milovidov
    Member

    The reason was incorrect implementation of move-assignment in Field.
    The issue was presented only in cases when column of String or Array type was used in primary key.

  7. hereTac commented on Jun 25, 2018

    @hereTac

    1.Create tablea(memory).
    2.Create tableb(mergetree). Primary key is column with type Int.
    3. Load csv into the memory.
    4.Check clickhouse-server cached 4G memory.
    5.Exe SQL: Insert into tableb select * from tablea;
    6.Exe SQL: Drop table tablea;
    7.Check clickhouse-server still cache 4G+ memory.
    It still here. Why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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