Why Does Owl AutoMySQL Kill long Sleeping MySQL Connections?

If you’ve noticed that Owl AutoMySQL is terminating MySQL connections with the status SLEEP and are wondering why, here’s a detailed explanation.

Are Sleeping MySQL Connections Harmful?

At first glance, sleeping connections might seem harmless because they are idle and not actively using CPU. However, they can still cause issues:

  • Memory Usage: Even sleeping connections consume server memory, and excessive idle connections can lead to high RAM usage.
  • Connection Slots: Each sleeping connection occupies a connection slot. If many accumulate, the server can hit the max_connections limit. When this happens, new connections are rejected with the error: "Too many connections."
  • Open Transactions: In some cases, sleeping connections can hold open transactions, preventing other queries from completing.
  • Performance Bottlenecks: It’s not uncommon to see thousands of sleeping queries pile up on busy shared hosting servers, which can severely degrade performance and cause server instability.

Why Does Owl AutoMySQL Kill Sleeping Connections?

Owl AutoMySQL is designed to proactively manage MySQL resource usage on your server. Killing sleeping connections helps:

  • Prevent memory bloat and resource exhaustion.
  • Avoid hitting the max_connections limit.
  • Ensure that new queries can connect without interruptions.
  • Maintain overall server stability and avoid performance degradation.

This approach is a standard best practice, especially on shared hosting environments and for servers not using CloudLinux MySQL Governor. It allows hosting providers to better manage idle connections and ensure that no single website can exhaust MySQL resources.

What If I Don't Want Sleeping Connections Killed?

While we generally do not recommend disabling this behavior, you can add specific MySQL users to the exclusion list using either the WebUI or the CLI.

Method 1: Using the WebUI (Recommended)

 

 

 

  1. Open the cPFence WebUI on your Main Control Panel server.
  2. Go to System Settings in the left sidebar.
  3. Use the server dropdown to select the target server.
  4. Click Adjust Settings (One Server).
  5. Click Load Current Settings.
  6. Find the EXCLUDED_USERS_AUTO_MySQL field and enter the MySQL users you want to exclude, separated by | (for example: my_user1|my_user2|my_user3).
  7. Scroll down and click Save & Restart to apply your changes.

Owl AutoMySQL will no longer monitor or terminate queries for the excluded users you specified.

Method 2: Using the CLI

  1. SSH into your Main Control Panel server.
  2. Edit the configuration file:
nano /opt/cpfence/config.conf
  1. Locate or add the following line, listing the MySQL users you want to exclude (separated by |):
EXCLUDED_USERS_AUTO_MySQL="my_user1|my_user2|my_user3"
  1. Save the file and restart cPFence:
cpfence --restart

This will prevent Owl AutoMySQL from monitoring or killing queries for the excluded users.


Need Further Assistance?

If you encounter any issues or need additional help, feel free to reach out to our support team via your client portal.

  • 0 Bu dökümanı faydalı bulan kullanıcılar:
Bu cevap yeterince yardımcı oldu mu?

İlgili diğer dökümanlar

What is the Recommended SWAP Size with the New Owl AutoMySQL Module?

If you're using the all new Owl AutoMySQL module, We highly recommend disabling SWAP for better...

Troubleshooting Repeated Alerts from cPFence Owl WatchDog

The cPFence Owl WatchDog is a smart monitoring system that automatically keeps your server’s most...

How to Change Resource Usage Alert Thresholds in cPFence?

If you're receiving frequent email alerts about server resource usage—such as CPU, memory, disk...

How to Enable / Disable cPFence Owl™ ?

cPFence Owl™ is a smart 24/7 monitoring system that provides advanced security features,...

Managing Slow Queries and Scripts Using cPFence Owl™

Note: It is now recommended to use the automatic feature instead of manual blacklisting. To learn...