H-Sphere Reseller Guide

Controlling RAM And CPU Usage

(version 2.09 and higher)

 

To prevent overconsumption of your server's resources by users' cgi scripts, you can use Resource Limit Controls. It allows you to control the usage of the CPU, memory and server processes on the box with the web server.

* RLimit Controls use directives of Apache 1.2.X modules and, therefore, are not applicable for Windows hosting.

This document explains how to:


Enable RLimit in Plans

To apply RLimit to user scripts under a certain plan, scroll down to the Other section of the Plan Edit Wizard Step 1. It lists the following resources:

  • RLimitCPU - restrict the strain of CPU usage.
  • RLimitCPU Min (in H-Sphere 2.5) - set the soft resource limit in seconds per process.
  • RLimitCPU Max (in H-Sphere 2.5) - set the maximum resource limit in seconds per process.
  • RLimitMEM - restrict the memory used by processes run on the server.
  • RLimitMEM Min (in H-Sphere 2.5) - set the soft resource limit in bytes per process.
  • RLimitMEM Max (in H-Sphere 2.5) - set the maximum resource limit in bytes per process.
  • RLimitNPROC restrict the number of the processes run simultaneously.
  • RLimitNPROC Min (in H-Sphere 2.5) - set the minimum number of processes.
  • RLimitNPROC Max (in H-Sphere 2.5) - set the minimum number of processes.

Configure RLimit Values

In most cases the default values are the best to prevent overconsumption of system resources on the one hand and allow correct performance of cgi scripts on the other.

To set custom values for these resources, select Plans in the INFO menu. Then, click the resources link next to the plan you would like to edit. On the page that appears, find:
RLimitCPU The Min parameter sets the soft resource limit for all processes and the Max parameter sets the maximum resource limit.
CPU resource limits are expressed in seconds per process.
RLimitMEM The Min parameter sets the soft resource limit for all processes and the Max parameter sets the maximum resource limit.
Memory resource limits are expressed in bytes per process.
RLimitNPROC  The Min parameter sets the soft resource limit for all processes and the Max parameter sets the maximum resource limit.
 Process limits control the number of processes per user.

Warning: Don't change any parameters other than Min and Max.

WARNING:
Enabled RLimitMEM may affect the performance of certain CGI scripts and may result in FrontPage, Miva, and AWStats failures. Users may get the "premature end of script headers" message. Therefore, you should disable RLimitMEM if your customers use FrontPage, Miva, and AWStats, because these products use a lot of RAM.
For more info, please refer to Apache Documentation: What does it mean when my CGIs fail with "Premature end of script headers"?

The above changes will be applied only to accounts created thereafter. If you need to apply these changes to a specific existing account, enter this account's control panel, go to the Web Options page, and click Apply Changes.


Limiting Resource Use For Individual Accounts

Tip: To switch RLimitMEM OFF for one account in a plan where RLimitMEM is ON, do the following:

  1. Switch RLimitMEM OFF for the whole plan
  2. Enter this accounts' control panel
  3. Go to the Web Options page
  4. Click Apply Changes
  5. Go back to your admin control panel
  6. Switch RLimitMEM back ON for the whole plan

The reverse procedure can be used to switch RLimitMEM ON for one account in a plan where RLimitMEM is OFF.

 



© Copyright 2004-2007. Host Reseller Inc.
All rights reserved.