Resource overload is a common issue during the operation of a database system. It can lead to system performance degradation, negatively impact user experience, and even cause service unavailability. The following table describes three major resource overload scenarios: CPU spike, high memory load, and connection exhaustion in terms of symptoms, causes, and impacts on services.
Table 1 Resource overload scenarios | Scenario | Symptom | Cause | Impact on Services |
| CPU spike | - The CPU usage remains close to or reaches 100%.
- The query response time increases significantly.
- The overall system performance deteriorates, which may cause stuttering or lag.
| - As service traffic increases, a large number of concurrent query requests flood into the database.
- The number of complex SQL queries increases.
- The application-layer cache becomes invalid, causing a large number of requests to directly access the database.
- During peak hours, user traffic surges.
- The database index design is improper.
| - The application response delay increases, and user experience deteriorates.
- The transaction processing capability deteriorates, and the service throughput decreases.
- The system stability deteriorates, and timeout errors may occur.
- In extreme cases, the service may be unavailable.
|
| High memory load | - The memory usage remains high.
- The database cache hit ratio decreases.
- Frequent memory swapping may occur in the system.
- A memory usage alarm is generated.
- A primary/standby switchover occurs or the node reboots.
| - As traffic increases, the database needs to cache more data and query results.
- The number of concurrent connections increases, and each connection occupies memory.
- A large number of complex queries increase the usage of session-level memory, such as the sort buffer (sort_buffer) and join buffer (join_buffer).
- Stored procedures generate a large amount of cached data for subsequent use, avoiding repeated parsing overhead. If a large number of different or complex stored procedures are called, cached data will quickly accumulate, which may cause a sharp increase in memory usage and affect the overall database performance.
- Accumulation of prepared statements causes the memory usage to increase slowly.
| - The database performance deteriorates, and the query response time increases.
- An out of memory (OOM) error is triggered, causing a primary/standby switchover or node reboot. During the switchover or reboot, services are intermittently interrupted.
|
| Connection exhaustion | - The database connection pool usage is close to or reaches the upper limit.
- The waiting time for new connection requests increases.
- Applications may experience database connection timeout errors.
- An alarm about connection exhaustion is generated.
| - As service traffic increases, applications require more database connections.
- The connection pool configuration at the application layer is improper.
- A large number of requests flood in within a short period of time, causing the number of connections to increase rapidly.
- Increased traffic leads to longer transaction processing time and prolonged connection occupation.
- Connections are not correctly released due to application code issues.
| - Applications cannot obtain database connections, resulting in request failures.
- The system throughput decreases and cannot process more concurrent requests.
- User experience deteriorates, and error messages may be displayed.
- In extreme cases, application services may be unavailable.
|