Practical considerations across Linux, Storage, ASM, Redo Logs, and Oracle Database (Part I)
Technical article | Oracle Database
19c / 26ai | Oracle Linux 8,9
1. Introduction
Write-intensive Oracle Database workloads place significant
pressure on multiple infrastructure components:
- Storage devices and storage
controllers.
- Linux block I/O and filesystem
layers.
- Oracle ASM and disk group
architecture.
- Online redo logs and the LGWR
process.
- Database Writer (DBWn) and
checkpoint operations.
- Undo, temporary tablespaces, and
application transaction management.
Optimizing these environments requires more than increasing
disk throughput or changing Oracle initialization parameters. For example, a
database experiencing high log file sync waits might have a redo write latency
problem, excessive commit frequency, storage-controller contention, or
synchronous redo transport overhead in a Data Guard configuration. Similarly,
high data-file write latency might be related to DBWR activity, checkpoint
pressure, storage congestion, or inefficient SQL statements.
The first principle is to identify the actual bottleneck
before changing configuration parameters.
The following sections cover the most important optimization
areas.
2. Linux Operating System and
Storage Tuning
2.1. Filesystem access time
(noatime)
For Oracle databases using conventional filesystems rather
than ASM, Linux can update file access timestamps (atime) whenever files are
accessed.
These metadata updates introduce additional filesystem
activity.
The noatime mount option disables access-time updates and
can reduce unnecessary metadata writes.
Example /etc/fstab configuration:
/dev/sdb1 /u01 xfs defaults,noatime 0 0
Apply the configuration during an appropriate maintenance
window and verify it:
mount | grep
/u01
Important considerations:
- This optimization applies to
filesystem-mounted storage, not ASM disks.
- Modern Linux filesystems
commonly use relatime by default.
- The performance improvement may
be negligible on systems where metadata updates are not a bottleneck.
- Some backup or application tools
depend on access timestamps
Note: Disabling atime updates by using the noatime
mount option can break applications that rely on them, for example, backup
programs.
2.2. Linux Read-Ahead tuning
Read-ahead is an operating system mechanism that prefetches
data into memory based on anticipated future read requests.
It is particularly useful for sequential workloads,
including:
- Full table scans.
- Data warehouse queries.
- RMAN backup and restore
operations.
- Large sequential file reads.
- ETL processing.
However, aggressive read-ahead can result in unnecessary I/O
for workloads dominated by small random reads.
Check the current read-ahead value:
blockdev --getra /dev/sdb
The returned value is expressed in 512-byte sectors.
For example:
|
Value |
Read-ahead size |
|
512 |
256 KB |
|
1024 |
512 KB |
|
2048 |
1 MB |
|
4096 |
2 MB |
|
8192 |
4 MB |
To inspect additional device characteristics:
blockdev
--getss /dev/sdb
blockdev
--getpbsz /dev/sdb
blockdev
--getiomin /dev/sdb
blockdev
--getioopt /dev/sdb
Modify read-ahead temporarily:
# Set 1 MB
blockdev --setra 2048
/dev/sdb
# Set 2 MB
blockdev --setra 4096
/dev/sdb
# Disable read-ahead
blockdev --setra 0
/dev/sdb
Alternatively, inspect and configure the kernel queue
parameter:
cat
/sys/block/sdb/queue/read_ahead_kb
echo
1024 > /sys/block/sdb/queue/read_ahead_kb
How should you choose the value?
There is no universal optimal value for Oracle databases.
|
Workload |
Tuning approach |
|
OLTP, random I/O |
Test lower read-ahead values |
|
Data warehouse,
sequential reads |
Test higher read-ahead values |
|
RMAN backup/restore |
Evaluate higher values under actual
backup workloads |
|
Mixed workloads |
Compare multiple values using
production-like tests |
For example, if the current value is 4096 sectors (2 MB), test 2048 sectors (1 MB) and compare the results.
Monitor:
iostat
-x 1; vmstat 1
Pay attention to:
- Average read and write latency.
- Queue depth.
- Device utilization.
- Throughput.
- CPU I/O wait.
- Application response time.
Making read-ahead persistent
The value configured through blockdev --setra does not
necessarily survive a reboot.
One approach is to use a systemd service that executes after
TuneD:
# /etc/systemd/system/setra.service
[Unit]
Description=Set custom block device read-ahead
After=tuned.service
Requires=tuned.service
[Service]
Type=oneshot
ExecStart=/sbin/blockdev --setra 2048 /dev/sdb
[Install]
WantedBy=multi-user.target
Activate it:
systemctl daemon-reload
systemctl enable --now setra.service
Verify:
blockdev --getra /dev/sdb
For production systems, ensure the service targets the
correct device after device discovery, particularly when using multipath or
dynamically attached storage.
2.3. Read-Ahead and ASM
Allocation Unit Size
ASM Allocation Unit Size (AU_SIZE) and Linux read-ahead are
two different mechanisms.
ASM
AU_SIZE
An allocation unit is the fundamental unit of storage
allocation within an ASM disk group.
In Oracle Database 19c, the default AU size is generally:
- 1 MB for external, normal, and
high redundancy disk groups.
- 4 MB for flex disk groups.
- 4 MB on engineered systems.
Depending on disk group compatibility, supported AU sizes
include 1, 2, 4, 8, 16, 32, and 64 MB.
Linux
Read-Ahead
Read-ahead controls the amount of data the operating system
attempts to prefetch for sequential reads.
These mechanisms operate at different layers.
An important note: Read-ahead
does not need to be at least half of the ASM AU size, and matching read-ahead
to AU size does not guarantee better performance.
ASM AU size is not the same as the physical I/O request
size. Oracle can issue I/O requests that are smaller or larger than an AU.
Also, ASM commonly uses direct I/O paths, so filesystem
page-cache read-ahead assumptions should not automatically be applied to ASM
disks.
My recommendation: Select ASM AU_SIZE based on the
database architecture and workload requirements. Tune operating-system
read-ahead independently, and only where the actual I/O path benefits from it.
2.4. Linux Dirty Page and Swappiness Parameters
Linux uses memory to cache data and temporarily hold
modified pages before writing them to storage.
Two important parameters control background and foreground
dirty-page writeback.
Inspect the current settings:
sysctl
vm.dirty_background_ratio
sysctl
vm.dirty_ratio
sysctl
vm.swappiness
|
Parameter |
Purpose |
|
vm.dirty_background_ratio |
Percentage of memory at which
background writeback starts |
|
vm.dirty_ratio |
Threshold at which processes
generating writes can be forced to participate in writeback |
|
vm.swappiness |
Influences the kernel's tendency to
reclaim anonymous memory through swapping |
Example values sometimes evaluated in database environments:
vm.dirty_background_ratio
= 5
vm.dirty_ratio
= 20
vm.swappiness
= 10
These are starting points for testing, not universal Oracle
recommendations.
Important: Lowering dirty-page thresholds can
reduce large bursts of dirty data, but it can also increase the frequency of
writeback activity.
Ø
Similarly, setting
vm.swappiness=0 does not mean that swapping is universally impossible. The
appropriate setting depends on memory pressure and the operating system
configuration.
Monitor memory and swapping:
vmstat 1;
free -h; sar -W 1
For Oracle systems, avoiding memory overcommitment and ensuring adequate physical RAM are more important than simply disabling swap.
The
discussion continues in the next part.