我们的服务器是RHEL 7,具有256GiB的RAM.
DBA不希望看到系统交换,因此他们希望我们非常积极地监控16GiB的交换.
我建议我们将RAM加倍到512GiB(费用已获批准),并禁用交换.但是,这反对Oracle建议使用16GiB的RAM,即使我们将RAM加倍.
老实说,我不知道3%的swap是否有任何意义,或者为什么如果我添加的RAM比我们交换的更多,我们必须保持交换.
那么,有什么好的论据可以用来证明在没有交换的情况下运行Oracle吗?
附:我提到RAM加倍的唯一原因是为了证明我正在努力争论的论点的荒谬.我真正想要的是证明禁用交换的理由.
解决方法
>您的软件可以优雅地处理内存不足的情况或限制自身以避免OOM情况
>具有一致的性能是至关重要的(当您的系统交换时,延迟会增加,这可能足以使其对许多应用程序无效)
这类事情经常发生在数据库中.我在nosql数据库中看到的更多,但关系数据库可能遇到同样的挑战.
操作系统中没有任何东西需要交换. Linux通过杀死要求内存的最后一个进程来优雅地处理这个问题.您不希望达到这一点,因此请确保将Oracle调整为仅使用~90%的内存,以便系统守护程序和错误余量留有余地. “免费”内存也被用于缓冲磁盘I / O,这是一个巨大的性能胜利,因此试图通过数据库本身消耗更多内存最终会降低整体系统性能,从而导致适得其反.
即使系统中存在一小部分内存,如果应用程序是数据库或缓存或类似系统,我也默认不进行交换.
当局
因此,您不仅仅依赖于my字:
卡桑德拉
Datastax为Cassandra解释:
You must disable swap entirely. Failure to do so can severely lower performance. Because Cassandra has multiple replicas and transparent failover,it is preferable for a replica to be killed immediately when memory is low rather than go into swap. This allows traffic to be immediately redirected to a functioning replica instead of continuing to hit the replica that has high latency due to swapping. If your system has a lot of DRAM,swapping still lowers performance significantly because the OS swaps out executable code so that more DRAM is available for caching disks.
了Riak
Basho为Riak解释你应该:
Ideally,you should disable swap to ensure that Riak’s process pages are not swapped. Disabling swap will allow Riak to crash in situations where it runs out of memory. This will leave a crash dump file,named
erl_crash.dump
,in the/var/log/riak
directory which can be used to determine the cause of the memory usage.
Percona坐在围栏上,为问题的双方提供了有用的警告. MariaDB不同意禁用交换:
While some disable swap altogether,and you certainly want to avoid any database processes from using it,it can be prudent to leave some swap space to at least allow the kernel to fall over gracefully should a spike occur. Having emergency swap available at least allows you some scope to kill any runaway processes.
ServerFault
A well received answer here包括:
I personally find a swappy system worse than a crashed system. A crashed system would trigger a standby backup server to take over much sooner. And in an active-active (or load balanced setup) a crashed system would be taken out of rotation much sooner. A win for the no-swap system again.
这个答案今天有22个赞成,现在是4岁.您还可以看到其他一些答案,他们颂扬交换的价值,但没有迹象表明他们正在运行数据库.他们也没有那么多的赞成. 原文链接:/linux/399753.html