How to manage page cache resources when starting Kafka in Kubernetes

I have been running Kafka on Kubernetes for a long time without any major problem; however, I recently introduced the Cassandra pods cluster and started having problems with Kafka.

Although Cassandra does not use a page cache such as Kafka, it does write frequently to disk, which seems to affect the kernel cache.

I understand that Kubernetes pods manage memory resources through groups that can be configured by setting memory requests and restrictions in Kubernetes, but I noticed that using the Cassandra page cache can increase the number of page errors in my Kafka modules even if they don't seem to compete for resources (i.e. there is memory on their nodes).

In Kafka, more page errors result in more writes to disk, which impedes the benefits of serial I / O and reduces disk performance. If you use something like AWS EBS volumes, this will ultimately lead to depletion of your packet balance and, ultimately, to catastrophic failures in your cluster.

My question is, can I isolate page cache resources in Kubernetes or somehow tell the kernel that pages belonging to my Kafka modules should be kept in cache longer than in my Cassandra channels?

+4
source share
1 answer

I thought this was an interesting question, so this is posting some conclusions due to a little digging.

: K8s OOB , , , DaemonSet.

:

fadvise(), , , , , .

http://man7.org/linux/man-pages/man2/posix_fadvise.2.html

O_DIRECT, -:

https://lwn.net/Articles/457667/

, Cassandra fadvise , :

http://grokbase.com/t/cassandra/commits/122qha309v/jira-created-cassandra-3948-sequentialwriter-doesnt-fsync-before-posix-fadvise

( 2017 .) Samsung Cassandra fadvise , SSD:

http://www.samsung.com/us/labs/pdfs/collateral/Multi-stream_Cassandra_Whitepaper_Final.pdf

Kafka - , fadvise . , , Kafka :

  • vm.dirty * , ()
  • vm.vfs_cache_pressure , RAM .

2.6 :

https://www.thomas-krenn.com/en/wiki/Linux_Page_Cache_Basics

Cgroups v1 v2 - pid, - :

https://andrestc.com/post/cgroups-io/

, linux-ftools fadvise :

https://github.com/david415/linux-ftools

. kafka cassandra (, - ), (kafka over cassandra ) IO ( ), , .

+3

Source: https://habr.com/ru/post/1693160/


All Articles