Skip to content

Amazon RDS MySQL: 99% system CPU, mysqld unexpectedly restarted, repeated failures resolved after Stop/Start — what could cause this?

0

Hello,

I'm investigating a production incident involving Amazon RDS for MySQL and would appreciate help identifying its possible root cause.

On October 14, 2026, our RDS instance experienced a sudden and severe performance degradation. The database became unresponsive, causing our web application to exhaust all 200 Apache workers.

The most unusual finding is that OS-level CPU usage (system) reached approximately 99% for several minutes, while normal MySQL query processing appeared to stop.

Environment

  • Region: sa-east-1 (São Paulo)
  • Database engine: Amazon RDS for MySQL 8.4
  • Instance class during the incident: db.m6g.xlarge (4 vCPUs, 16 GiB RAM)
  • Application: Laravel/PHP running on EC2 Debian 11 with Apache prefork
  • Enhanced Monitoring: enabled
  • Database class is changed automatically three times daily to optimize costs. The morning change to db.m6g.xlarge occurs at 06:30 (UTC-3).

Incident timeline

All times below are São Paulo local time (UTC-3).

TimeObservation
08:25:54CPU system 1.5%, iowait 0.8%; normal operation
08:26:54iowait increased to 13.3%
08:27:54iowait reached 61.7%; CPU system 37.7%; network traffic dropped sharply
08:28:40Apache reached MaxRequestWorkers=200
08:28:54CPU system increased to 83.8%
08:29:54CPU system reached 99.1%
08:30:54CPU system 99.2%
08:31:54CPU system 99.3%
08:32:54CPU system 99.4%; mysqld was still present in process monitoring
08:33:25mysqld no longer appeared in the process list; memory usage dropped sharply
08:33:43MySQL error log recorded MySQL Server - start
08:36:03MySQL reported mysqld: ready for connections

Important findings

1. Very high system CPU, not user CPU

At 08:30, Enhanced Monitoring reported:

  • os.cpuUtilization.system.avg: 99.2%
  • os.cpuUtilization.user.avg: 0.7%
  • os.cpuUtilization.wait.avg: 0.1%

This suggests that the CPU was predominantly consumed in kernel mode rather than normal MySQL query execution.

2. The operating system did not appear to reboot when mysqld restarted

Enhanced Monitoring reported:

  • 08:32:54 — OS uptime: 02:02:32
  • 08:33:25 — OS uptime: 02:03:03

The OS uptime continued increasing normally, even though the MySQL process subsequently restarted.

3. No manual reboot was requested during the initial incident

We did not manually reboot RDS at 08:33–08:36.

Our CloudTrail searches did not identify a RebootDBInstance API call or another RDS management event explaining this initial restart.

4. Swap was not in use

Enhanced Monitoring reported swap.total = 0, and the CloudWatch SwapUsage metric showed zero in the available samples.

FreeableMemory was low before the incident, but we have no evidence confirming an out-of-memory kill.

5. The incident occurred repeatedly

After the database recovered at approximately 08:36–08:39, similar failures occurred two or three more times between approximately 09:00 and 10:20.

Manually rebooting the RDS instance temporarily restored service. However, the database became unresponsive again after several minutes or tens of minutes.

6. Stop/Start provided a much longer recovery

We eventually stopped the RDS instance completely and started it again.

The procedure took approximately 30 minutes.

After this full Stop/Start cycle, our application remained stable for the entire afternoon, without further observed incidents.

I understand that Stop/Start and Reboot are different RDS operations, and that Stop/Start reprovisions the underlying compute instance. However, I cannot confirm whether an underlying physical host was changed.

Questions

  1. What could cause Amazon RDS MySQL to transition from high iowait (61.7%) to almost 100% CPU system usage within approximately two minutes?

  2. Could this behavior indicate a kernel-level issue, storage subsystem problem, memory-management issue, MySQL internal problem, or RDS infrastructure issue?

  3. What could cause mysqld to disappear and restart while the operating system uptime continues normally, without an identified user-initiated reboot?

  4. Why might repeated RDS reboots temporarily resolve the issue, while a complete Stop/Start provides sustained stability?

  5. Is there a way, using Enhanced Monitoring, CloudWatch Logs, Database Insights, or other tools available without a paid AWS Support plan, to determine whether mysqld was terminated by an internal watchdog, OOM killer, crash, or RDS management action?

  6. Could the automated DB instance class modification at 06:30 have contributed to the problem approximately two hours later, even though the instance initially operated normally?

  7. What additional metrics or diagnostic information should I preserve to investigate the root cause and prevent recurrence?

Available evidence

I have collected:

  • RDS Enhanced Monitoring (RDSOSMetrics) JSON covering the incident
  • CPU and I/O metrics from Database Insights
  • RDS MySQL error logs
  • CloudTrail event history
  • CloudWatch metrics, including database connections, memory and swap
  • Apache access/error logs showing application degradation

I can share sanitized excerpts or specific metric values if needed.

My main goal is to understand why the RDS instance experienced this severe OS-level CPU condition and why MySQL needed to restart, rather than simply mitigating the resulting Apache worker exhaustion.

Any technical guidance or similar experiences would be greatly appreciated.

Thank you!

2 Answers
0

Based on the symptoms you've described—particularly the transition from high iowait to 99% system CPU, followed by mysqld disappearing without an OS reboot—this pattern suggests a critical resource contention issue that escalated to a point where the MySQL process became unresponsive or was terminated by an internal mechanism.

Addressing your specific questions:

  1. High iowait transitioning to 99% system CPU: This progression typically indicates that the system initially experienced storage I/O bottlenecks (the 61.7% iowait), which then cascaded into kernel-level resource contention. When I/O operations queue up extensively, the kernel spends increasing amounts of time managing these operations, context switching between processes, and handling resource allocation—all of which consume system CPU rather than user CPU. The fact that user CPU remained under 1% while system CPU hit 99% strongly suggests the kernel was overwhelmed managing resources rather than executing normal database queries.

  2. Potential root causes: Given your symptoms, the most likely scenarios are:

    • Memory pressure leading to excessive paging/swapping attempts: Even though swap was disabled and you saw no swap usage, severe memory pressure can cause the kernel to spend enormous amounts of system CPU attempting memory management, scanning for reclaimable pages, and handling out-of-memory conditions.
    • Storage subsystem issues: Problems with the underlying EBS volumes or storage network could cause I/O operations to stall, leading to kernel threads consuming CPU while waiting for storage operations to complete or timeout.
    • Resource contention from excessive connections: A connection storm or sudden spike in concurrent connections can cause the kernel to spend significant CPU on context switching and connection management, especially when combined with memory pressure.
  3. mysqld disappearing without OS reboot: When mysqld vanishes from the process list while OS uptime continues normally, this indicates the process was terminated rather than the system rebooting. Possible mechanisms include:

    • An internal RDS watchdog detecting an unresponsive database process
    • The Linux OOM (out-of-memory) killer terminating mysqld due to memory exhaustion, even if you didn't capture direct evidence
    • MySQL itself crashing due to an internal error or resource exhaustion
    • RDS infrastructure management terminating an unhealthy process
  4. Why Stop/Start provided sustained stability: Stop/Start reprovisioning the underlying compute instance likely resolved the issue because it:

    • Allocated fresh underlying hardware, potentially moving away from a problematic host
    • Cleared any kernel-level resource leaks or stuck states
    • Reset all system-level caches and buffers
    • Provided a completely clean slate for memory management

    Simple reboots restart the MySQL process but maintain the same underlying infrastructure, so if there was a host-level issue (such as degraded storage performance or kernel problems), reboots wouldn't resolve it.

  5. Determining termination cause: Without a paid support plan, your best diagnostic approach is:

    • Check the MySQL error log for crash signatures, assertion failures, or out-of-memory messages immediately before the restart
    • Review Enhanced Monitoring data for memory metrics (particularly memory.free, memory.cached, memory.buffers) leading up to the incident
    • Look for patterns in process counts and memory consumption per process
    • Check RDS Events in the console for any automated actions taken by RDS
    • Examine CloudWatch metrics for DatabaseConnections spikes that might indicate a connection storm
  6. Instance class modification contribution: The automated scaling at 06:30, two hours before the incident, is unlikely to be the direct cause since the instance operated normally during that interval. However, if the workload pattern changed after the scaling (for example, batch jobs or reporting queries that only run during business hours), the smaller instance class might have been insufficient for the actual workload, leading to progressive resource exhaustion.

  7. Additional metrics to preserve:

    • Database-level metrics: active connections over time, query throughput, transaction rates
    • Enhanced Monitoring: detailed per-process memory consumption, disk I/O queue depths, network statistics
    • Performance Insights data showing top SQL statements and their resource consumption (CPU, I/O, locks) during the incident window
    • MySQL slow query log if enabled
    • Any application-level metrics showing query patterns or connection pool behavior

Recommended preventive actions:

  • Monitor resource usage proactively: Set up CloudWatch alarms for CPU utilization, memory, and I/O metrics that trigger before reaching critical thresholds. This allows you to detect resource contention before it becomes severe.

  • Use Performance Insights: Enable and regularly review Performance Insights to identify resource-intensive queries. The database load chart can help you understand which queries are consuming the most CPU, I/O, or memory resources.

  • Optimize your workload: Review your application's database usage patterns, especially around the time the incident occurred. Look for:

    • Long-running or inefficient queries that could be optimized
    • Sudden increases in connection counts
    • Batch operations or reporting queries that might overwhelm the instance
    • Missing indexes or suboptimal query execution plans
  • Consider instance sizing: If your workload consistently consumes high amounts of resources during business hours, the db.m6g.xlarge instance may be undersized. Consider either maintaining a larger instance class during peak hours or optimizing queries to reduce resource consumption.

  • Review connection management: Ensure your application properly manages database connections, uses connection pooling effectively, and doesn't create connection storms during startup or failover scenarios.

The combination of high system CPU, I/O wait, and process termination followed by sustained stability after Stop/Start strongly suggests either a host-level infrastructure issue or severe resource exhaustion that required complete reprovisioning to resolve. Implementing proactive monitoring and workload optimization should help prevent recurrence.
Sources
Troubleshoot restarts and failovers in Amazon Aurora | AWS re:Post
cpu - Amazon Aurora
CPU - Amazon Relational Database Service

answered a month ago

0

It fits one pattern closely: memory exhaustion on a system with no swap. Below is why, and how to confirm it with free tools.

The most likely chain of events

  1. Free memory runs out. FreeableMemory was already low, and swap is 0.
  2. The kernel starts thrashing page cache. With no swap, it can only free memory by dropping file-backed pages: the page cache, and the mysqld binary and library code pages. Those pages are needed immediately and get read back from EBS. That matches iowait rising from 13% to 62% at 08:26–08:27.
  3. The kernel spends almost all its time on memory reclaim. Direct reclaim and compaction run in kernel mode, which gives ~99% system CPU with ~0.7% user CPU. MySQL makes almost no progress, so network traffic drops and Apache uses up all 200 workers.
  4. mysqld is killed while the OS stays up. This is the OOM killer or RDS's own health monitoring. mysqld holds most of the memory, so killing it frees it at once. That matches the sharp memory drop at 08:33:25, while OS uptime keeps counting.
  5. RDS restarts mysqld in place. "Server - start" at 08:33:43 and "ready for connections" at 08:36:03, which included crash recovery.

Answers to your questions

Why iowait first, then system CPU? This sequence is typical of memory pressure without swap: first heavy page-cache re-reads, then reclaim taking over the CPU. A storage failure alone would normally keep iowait high, not turn into nearly 100% system CPU.

Why does mysqld restart without an OS reboot? An OOM kill or a forced restart by RDS stops only the process. The OS keeps running, so uptime keeps counting. No RebootDBInstance call appears in CloudTrail because no API call was made.

Why did reboots only help briefly while Stop/Start held? After a reboot, the same instance class and the same load quickly push memory back to the limit. The buffer pool reloads, and 200 Apache workers reconnect. Stop/Start's lasting effect has two possible explanations:

  • The time of day. You change the instance class three times a day. Check whether the midday change moved you to a larger class after the Stop/Start. If it did, that, not the Stop/Start, is the likely reason the afternoon was stable.
  • A host problem. Stop/Start can place the instance on different hardware. Only AWS can confirm whether that happened.

Did the 06:30 class change contribute? Very likely. An OS uptime of about 2:02 at 08:32 means the OS started at about 06:30, which was the class change. The change set the amount of memory the instance had, and the morning load ramp then exceeded it. Check two things:

  • Are memory parameters set to fixed values sized for your larger daytime class? A fixed innodb_buffer_pool_size that doesn't use the {DBInstanceClassMemory*3/4} formula would take a much larger share of 16 GiB on db.m6g.xlarge.
  • How much memory each connection can use. Up to 200+ connections × (sort_buffer_size, join_buffer_size, read_buffer_size, temp tables), plus temptable_max_ram (1 GiB by default) and performance_schema.

Confirming the cause with free tools

  • RDS Events for the instance. In the console under Events, or with aws rds describe-events --source-type db-instance --duration 1440. RDS often records why it restarted the database, sometimes mentioning memory. Events are kept for only 14 days, so export them now.
  • The MySQL error log just before 08:33:43:
    • No shutdown messages, followed by InnoDB crash recovery, means the process was killed. SIGKILL from the OOM killer leaves no log entry of its own.
    • A stack trace with "mysqld got signal 11/6" means mysqld crashed.
    • Normal shutdown messages mean a controlled restart.
  • Enhanced Monitoring JSON from 08:20 to 08:33:
    • memory.free, memory.cached, memory.active/inactive. Cached memory dropping toward zero is strong evidence of thrashing.
    • diskIO read IOPS on the data volume rising sharply while cached memory falls.
    • processList: memory used by mysqld, and whether any other process is growing.
  • Database Insights: top wait events and DB load during the ramp, and whether connections or temp-table activity rose.
  • Directly in MySQL, ongoing: SHOW GLOBAL STATUS LIKE 'Max_used_connections', and SELECT * FROM sys.memory_global_by_current_bytes LIMIT 20 after the morning ramp, to see where memory goes.

Preventing a repeat

  • Keep enough memory headroom after the 06:30 downsize. Use the formula-based buffer pool setting, cap max_connections at a level the smaller class can support, and lower the per-connection buffers.
  • Reduce the number of connections. Prefork with 200 workers can open 200 database connections. RDS Proxy or a smaller worker or connection pool cuts per-connection memory a lot.
  • Alarm on FreeableMemory well above zero, sized to each instance class, so the next occurrence is caught before thrashing.
  • Reconsider the morning class, or move the downsize to after the morning peak. A memory-optimized class such as db.r6g/r7g at the same vCPU count gives twice the memory.

If the error log shows a real mysqld crash with a stack trace, or memory and cached memory weren't low before the incident, the memory explanation doesn't fit. In that case, send the Enhanced Monitoring JSON and error-log extracts to AWS so they can check the host.

EXPERT

answered a month ago

EXPERT

reviewed 3 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.