经常看到swap分区被使用,被缓存的内容本来是为了增加命中率,结果去不断换入换出,导致本地磁盘IO增加,影响访问速度。所以在内
经常看到swap分区被使用,被缓存的内容本来是为了增加命中率,结果去不断换入换出,导致本地磁盘IO增加,影响访问速度。所以在内存充足的情况下,如果我们觉得不需要使用swap分区的时候,那就要想办法尽量避免使用swap。
我的环境大部分都是Oracle数据库服务器,linux+oracle是常见组合,这里针对这个背景做一下分析。
1、hugepage功能
使用hugepages之后可以避免SGA被swap。
直接使用hugepages技术就可以,不要使用lock_sga和pre_page_sga参数,具体原因如下:
1). 根据文档 note 957525.1 和文档 note 1276966.1,启动PRE_PAGE_SGA会引发如下问题:
a) 初始连接到数据库变慢
b) RAC node频繁crash,如果没有使用hugepage
2). 而根据文档 note 1274096.1,再使用hugepages之后就不需要再起用lock_sga参数
3.)可以参考的文档
您可以参照文档:
HugePages on Oracle Linux 64-bit(NOTE:361468.1)
HugePages on Linux: What It Is... and What It Is Not...(Note: 361323.1)
2、swappiness参数
简单地说这个参数定义了系统对swap的使用倾向,默认值为60,值越大表示越倾向于使用swap。可以设为0,这样做并不会禁止对swap的使用,只是最大限度地降低了使用swap的可能性。通过sysctl -q vm.swappiness可以查看参数的当前设置。修改参数的方法是修改/etc/sysctl.conf文件,加入vm.swappiness=xxx,并重起系统。如果不想重起,,可以通过sysctl -p动态加载/etc/sysctl.conf文件,但建议这样做之前先清空swap。
事实上,使用hugepages之后可以避免SGA被swap, 但是如果引发swap分区使用的不是oracle SGA而是PGA或者过多的文件系统缓存,那么实际上对于您的swap/IO的问题可能并不能完全解决。这时候,用swappiness参数就可以更好地环节该问题。
3、找出元凶,杀之
如果上述方法都还不行,那你可以联系系统管理员来分析具体是哪一部分占用了过多的内存而引发swap,想办法停止那些进程或任务。
推荐阅读:
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
