Skip to content

Use jna fadvise in order to prevent poisoining the page cache #4746

@bolkedebruin

Description

@bolkedebruin

Druid relies on the page cache of Linux in order to have memory segments. However when loading segments from deep storage or rebalancing the page cache can get poisoned by segments that should not be in memory yet. This can significantly slow down Druid in case rebalancing happens as data that might not be queried often is suddenly in the page cache.

It is possible to advise the kernel what to do when writing and reading data and what the expectancy is of the app how the data should be treated. This is done by using posix_fadvise which has a JnA equivalent.

I suggest using this as it will speed up Druid under load.

  1. http://insights.oetiker.ch/linux/fadvise.html
  2. https://github.com/java-native-access/jna/blob/master/README.md
  3. https://github.com/apache/bookkeeper/blob/master/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/NativeIO.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions