nvme list and create an array with:
/dev/md0, backed by the RAID array with a chunk size of 512 Kb.
Filesystem
ClickHouse is most tested with the ext4 filesystem. When mounting the filesystem as ext4, make sure to set to noatime option to prevent linux from automatically updating a file’s “last accessed time” (atime) when it is read. This
improves the performance for Read-heavy workloads. Additionally the nobarrier option improves the performance by allowing the NVMe to re-order writes. This is potentially a durability issue as data can be lost on a crash, however,
the cache isn’t used to durably store data and the source-of-truth of ClickHouse data lives in Object Storage. Therefore, it is also possible to configure the fsck-pass to 0 (skip), there is no need for filesystem repair.
To configure this, change the /etc/fstab file:
blkid command. Use the mount command to remount the devices.
EmptyDir vs HostPath
For almost all cases we recommend using EmptyDir volumes. HostPath mounts are an option we don’t recommend due to the added operational complexity and security risks. Once the node-local NVMe disks are formatted and available for consumption in a Kubernetes cluster, the next decision to take is how to consume the disks. The ClickHouse Operator supports two modes currently to mount the NVMe disks into the ClickHouse Server pods:- HostPath volumes, creating a direct mapping from the Server pod to the Host (default for AWS)
- EmptyDir volumes, backed by Kubernetes’ Local Ephemeral Storage (default for other Cloud Providers)
Useful queries for the Filesystem cache
ClickHouse has several system tables that can provide insights into the Filesystem cache:- system.filesystem_cache_settings allows for introspection of the current configuration/
- system.filesystem_cache has information on all currently cached objects.
- system.filesystem_cache_log contains a log with all cache interactions.
SYSTEM DROP FILESYSTEM CACHE query can be used to drop the entire filesystem cache. This can be useful in cases where the filesystem cache is completely full
and ClickHouse is returning CANNOT_WRITE_TO_FILE_DESCRIPTOR errors due to the disk being full.