How to Address High Server Load Issues with cPFence?

Note: It is now recommended to use the automatic feature instead of manual blacklisting. To learn more about this, please read on.

What Is Owl AutoMySQL® and How Do I Use It?

High load average issues are generally outside the scope of cPFence support unless they are directly caused by cPFence itself. However, here are some general recommendations to help identify and address the root cause of high server load.

Step 1: Monitor Running Processes

Use a tool like htop to monitor your server in real-time and identify the processes or users causing high load. Once identified, take the following actions:

  • Add the Offending User to the Owl Blacklist:
    Prevent the user from overloading the server by blacklisting them in cPFence Owl.
  • Limit Resource Allocation:
    Use the Enhance cgroups feature to apply resource limits:
    • Navigate to Settings → Packages → Edit all packages → System resources.
    • Adjust the resource allocation as per the following examples:

Low-Level Package Recommendation Example

High-Level Package Recommendation Example

Step 2: Apply Overrides for Abusive Users

For users consistently causing high loads:

  • Navigate to the Enhance control panel.
  • Go to Websites → Open Overrides Page for the target website.
  • Apply the same limits as the Low-Level Package Example.

This will ensure the user is restricted to minimal resources, reducing their impact on the server.

Step 3: Identify and Block Abusive IPs

Identify the most active IP addresses connected to your server using the following command:

tail -n 50000 /var/local/enhance/webserver_logs/*.log | grep -E '"[^"]*" "[^"]*" "[A-Z]+ [^"]*" "[^"]*" "[^"]*" "[^"]*" "[^"]*" "[^"]*"' | awk '{print $1}' | sort | uniq -c | sort -nr

This command will:

  • Look at the last 50,000 lines of your web server logs.
  • Extract the IP addresses from those requests.
  • Sort and count the number of requests per IP address.

You can then review the IPs at the top of the list to see if any are making an unusually high number of requests.

Block Abusive IPs:

After identifying the offending IPs, block them using the following cPFence command:

cpfence --add-blacklist-ip IP_address

Note : Make sure to manually check the IP using this site before blocking it to avoid blocking Google or Cloudflare IPs or your own cluster IPs (e.g., 199.99.88.1) ; it's a common mistake.

Step 4: Block Entire Countries (Optional)

If your server is frequently targeted by traffic from a country you don’t need or serve, you can block all traffic from that country using this command:

cpfence --blacklist-country ISOCODE

For example, to block traffic from China, use:

cpfence --blacklist-country cn

This can significantly reduce unwanted traffic and stabilize your server.

Monitor High Load Situations

If you receive a high load notification from cPFence, open htop on the server to quickly identify which user is causing the issue. Add the identified user to the Owl Blacklist to prevent them from overloading the server in the future. Also, apply the same limits for any abusive user as recommended above using overrides in the Enhance control panel.

Final Notes

  • Setting and enforcing resource limits ensures consistent server performance.
  • Once these steps are implemented, managing server load becomes a "set it and forget it" process, allowing you to focus on other tasks with peace of mind.

Need Further Assistance?

If you have additional questions or require help, please contact our support team via the client portal.

  • load
  • 6 användare blev hjälpta av detta svar
Hjälpte svaret dig?

Relaterade artiklar

How to Update cPFence Software & Signatures ?

cPFence software and virus signatures are automatically updated by default, ensuring continuous...

How to Know the Current Installed cPFence Version ?

To check the currently installed version of cPFence and see if an update is available, you can...

How to Uninstall cPFence ?

If you need to remove cPFence from your system, follow the steps below to uninstall the software....

Resolving Delays in cPFence Command Execution

If you notice that cPFence commands are taking an unusually long time to complete, this is likely...

Is cPFence Compatible with Cloudflare and Quic.Cloud?

Yes, cPFence is fully compatible with both Cloudflare and Quic.Cloud. In fact, we recommend using...