user1646111
user1646111

Reputation:

PHP: How to limit processor usgae (Use only one core of CPU for example) or %10 Percent?

In PHP I can set memory LIMIT using ini settings ini_set("memory_limit","24M"); however, I want to dedicate only one core of the processor for all PHP programs on my server.

Currently, I am using Windows Server 2008 R2 running on Dell Workstation (8GB Ram, and Core i7 Processor). I solved this issue by using VMWare and dedicating only one core and 2GB for that virtual server, however, I am looking for configuration per module or per folder to assign different processor limit, if possible.

Upvotes: 3

Views: 595

Answers (1)

exussum
exussum

Reputation: 18568

you can use the quota system to limit by user.

http://technet.microsoft.com/en-us/library/ff384148%28WS.10%29.aspx

If you are running PHP as a user, this will work

If you want to limit processes running under the account with SID S-1-5-82-3006700770-424185619-1745488364-794895919-4004696415 to use only 10% of the CPU bandwidth, you would do the following; Open an administrator command prompt.

Type reg add HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Quota System\S-1-5-82-3006700770-424185619-1745488364-794895919-4004696415.

Open the Registry Editor and locate the sub key you created in the previous step.

Under this key, create a new REG_DWORD value CpuRateLimit and set its value to 10.

This will limit all the processes running under that account SID to use only 10% of the CPU.

Upvotes: 2

Related Questions