Skip to content

addBatch method cause Java heap memory char array grows too fast #1873

Description

@wangbing505

image
The scenario involves a large number of calls to the addBatch method, Then use jmap to view heap memory,has lots of char[],although they are all unreachable objects that can be GC dropped.But it will lead to frequent GC and high CPU usage. How to solve it

Activity

  1. chernser commented on Oct 21, 2024

    @chernser
    Contributor

    Hi @wangbing505

    • What is the ClickHouse jdbc version do you use?
    • Is it a requirement to use JDBC?
  2. wangbing505 commented on Oct 23, 2024

    @wangbing505
    Author

    Hi @chernser

    1. ClickHouse jdbc version is 0.2.6,Can a higher version solve this problem?
    2. yes,or Is there any other way to write data to clickhouse ?
  3. chernser commented on Oct 23, 2024

    @chernser
    Contributor

    @wangbing505

    1. Yes, please, update to the latest 0.7.0 version. I do not see such code in it and everything should work fine.
    2. Yes, you may use java client without JDBC - https://clickhouse.com/docs/en/integrations/java/client-v2

    Please let me know how the update goes. Thanks!

  4. wangbing505 commented on Oct 24, 2024

    @wangbing505
    Author

    @chernser
    Thank you for your answer,I will try using them and synchronize the results

  5. chernser commented on Nov 4, 2024

    @chernser
    Contributor

    @wangbing505 as the issue solved?

  6. wangbing505 commented on Nov 5, 2024

    @wangbing505
    Author

    @chernser hello, I have been delayed by other things and will try it next week

  7. wangbing505 commented on Nov 7, 2024

    @wangbing505
    Author

    @chernser Thank you, I tried it, Char [] has decreased,But there are other memory uses as well,maybe it's not a problem with the client anymore

  8. chernser commented on Jan 9, 2025

    @chernser
    Contributor

    Need to verify how jdbc-v2 handles it.

  9. chernser commented on Nov 14, 2025

    @chernser
    Contributor

    We might need to stream big SQL requests like we do with text formats.
    Will prioritize this work.

  10. added this to the 0.12.0 milestone on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions