when deploying DS, I find the compute pod that assigned to the second node is always in CreateContainer
status and hangs there. I ssh into that node and find its memory is occupied heavily by some other processes so the command response is so slow, and the cpu% is also busy with the swap daemon.
free
total used free shared buff/cache available
Mem: 8168772 105152 295732 7491216 7767888 273448
Swap: 0 0 0
Compare the normal node:
free
total used free shared buff/cache available
Mem: 8168772 123504 7041388 270836 1003880 7424612
Swap: 0 0 0
You see the shared and buff/cache parts are huge, I need to flush and clean it.
Note:
free -h
is more readable
If you have to clear the disk cache, this command is safest in enterprise and production, will clear the PageCache
only:
sync; echo 1 > /proc/sys/vm/drop_caches
It is not recommended to use this in production until you know what you are doing, as it will clear PageCache
, dentries
and inodes
. Because just after your run drop_caches, your server will get busy re-populating memory with inodes
and dentries
, original Kernel documentation recommends not to run this command outside of a testing or debugging environment. But what if you are a home user or your server is getting too busy and almost filling up it’s memory. You need to be able trade the benefits with the risk.
sync; echo 3 > /proc/sys/vm/drop_caches
What is
sync
command?
writes any data buffered in memory out to disk.
what is
dirty cache
?
Dirty Cache refers to data which has not yet been committed to the database (or disk), and is currently held in computer memory. In short, the new/old data is available in Memory and it is different to what you have in database/disk.
what is
clean cache
?
Clean cache refers to data which has been committed to database (or disk) and is currently held in computer memory. This is what we desire where everything is in sync.
what is
dentries
andinodes
?
A filesystem is represented in memory using dentries and inodes. Inodes are
the objects that represent the underlying files (and also directories). A dentry is an object with a string name (d_name), a pointer to an inode (d_inode), and a pointer to the parent dentry (d_parent)
what is
drop_caches
?
Writing to this will cause the kernel to dropclean caches
, as well as reclaimable slab objects like dentries and inodes. Once dropped, their memory becomes free. It will not kill any process.
This post is good to reference.