Why Swap is being Consumed when Physical Memory is Available in DBaaS System or in any Linux System

简介: Why Swap is being Consumed when Physical Memory is Available in DBaaS System or in any Linux System

GOAL

  • Why Swap is being Consumed when Physical Memory is Available in DBaaS System or in any Linux System.

free -m

total used free shared buffers cached
Mem: 120616 115746 4869 167 390 44187
-/+ buffers/cache: 71169 49447
Swap: 2047 1614 433
SOLUTION

  • It's normal for Linux systems to start swapping before the RAM is filled up. This is done to improve performance and responsiveness:

Performance is increased because sometimes RAM is better used for disk cache than to store program memory. So it's better to swap out a program that's been inactive for a while, and instead keep often-used files in cache.

Responsiveness is improved by swapping pages out when the system is idle, rather than when the memory is full and some program is running and requesting more RAM to complete a task.

  • In Linux, Swappiness is the rate at which kernel moves pages into and out of active memory. Swappiness can have a value of between 0 and 100

swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible. For Kernel version 3.5 and newer it disables swapiness.

swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache

  • You may check the the swappiness value using below (ideally on latest Linux system it's set to 60)

[opc@rrr ~]$ cat /proc/sys/vm/swappiness
60
[opc@rrr ~]$

相关文章
|
9月前
|
安全 Linux 数据安全/隐私保护
【Linux】文件服务CIFS(Common Internet File System)
【Linux】文件服务CIFS(Common Internet File System)
212 0
|
9月前
|
存储 监控 网络协议
【Linux】文件服务NFS(Network File System)
【Linux】文件服务NFS(Network File System)
196 0
|
10天前
|
消息中间件 Linux
Linux中的System V通信标准--共享内存、消息队列以及信号量
希望本文能帮助您更好地理解和应用System V IPC机制,构建高效的Linux应用程序。
78 48
|
2月前
|
Linux
【Linux】System V信号量详解以及semget()、semctl()和semop()函数讲解
System V信号量的概念及其在Linux中的使用,包括 `semget()`、`semctl()`和 `semop()`函数的具体使用方法。通过实际代码示例,演示了如何创建、初始化和使用信号量进行进程间同步。掌握这些知识,可以有效解决多进程编程中的同步问题,提高程序的可靠性和稳定性。
87 19
|
5月前
|
Docker 容器
14 response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file speci
14 response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file speci
87 1
|
9月前
|
消息中间件 Unix Linux
[Linux打怪升级之路]-system V共享内存
[Linux打怪升级之路]-system V共享内存
[Linux打怪升级之路]-system V共享内存
|
7月前
|
消息中间件 Linux
【Linux】进程间通信——system V(共享内存 | 消息队列 | 信号量)(下)
【Linux】进程间通信——system V(共享内存 | 消息队列 | 信号量)(下)
87 0
|
7月前
|
消息中间件 存储 Linux
【Linux】进程间通信——system V(共享内存 | 消息队列 | 信号量)(上)
【Linux】进程间通信——system V(共享内存 | 消息队列 | 信号量)(上)
106 0
|
8月前
|
消息中间件 Linux
【Linux】System V 消息队列(不重要)
【Linux】System V 消息队列(不重要)
|
8月前
|
消息中间件 算法 Unix
【Linux】System V 共享内存
【Linux】System V 共享内存