LFD excessive resource usage too much

#1
Hello,

I am constantly getting LFD notices about lsphp memory usage being high. Here is one example of many I get daily:

Time: Wed Jul 1 07:59:44 2015 -0400
Account: asdf
Resource: Virtual Memory Size
Exceeded: 580 > 500 (MB)
Executable: /usr/local/lsws/fcgi-bin/lsphp-5.4.37
Command Line: lsphp5:/home/asdf/public_html/index.php
PID: 683013 (Parent PID:651250)
Killed: No

My question is whether it's normal for lsphp to constantly run above 500mb nowadays? I do have several extensions loaded such as PDFlib, GD and imagick. I'm not sure what would contribute to this type of high memory usage?

Any advice would be appreciated.
 

NiteWave

Administrator
#2
can check with
#pmap -p pid-of-lsphp5-process

My question is whether it's normal for lsphp to constantly run above 500mb nowadays?
I think it depends the php script.
to measure if lsphp5 itself has consumed many memory, can test with a simple script
<?php
sleep(30);
?>

then check with pmap how many memory used.

in example of opcode extemsion, it'll explicitly pre-allocate memory defined in php.ini,
for GD, when reading and process a big size image, it'll dynamically allocate many extra memory as well.
 

NiteWave

Administrator
#5
#pmap -x pid-of-lsphp5
to get more info.

from man page of pmap:
Code:
EXTENDED AND DEVICE FORMAT FIELDS
       Address:   start address of map
       Kbytes:    size of map in kilobytes
       RSS:       resident set size in kilobytes
       Dirty:     dirty pages (both shared and private) in kilobytes
       Mode:      permissions on map: read, write, execute, shared, private (copy on write)
       Mapping:   file backing the map, or '[ anon ]' for allocated memory, or  '[ stack ]' for the program stack
       Offset:    offset into the file
       Device:    device name (major:minor)
so pay attention to those "[ anon ]", it's allocated memory and may consume huge memory.
for
0000000000400000 11616K r-x-- /usr/local/lsws/fcgi-bin/lsphp-5.4.37
00007fe0ba1c2000 2048K ----- /opt/cloudlinux/lib/ImageMagick-6.5.4/modules-Q16/coders/svg.so
00007fe0c0d2b000 2048K ----- /opt/cloudlinux/lib/ImageMagick-6.5.4/modules-Q16/coders/mpr.so
etc, actually haven't consumed much memory and .so is shared at OS level.
 
Last edited:
#6
I'm getting similar messages, but no details available on pmap. Trying to imagine a scenario where litespeed needs 200mb of virtual memory to load a web page, so increasing the limit to turn off the alerts doesn't seem wise. Any idea how to find the root of the issue.

Code:
Time:         Thu Apr  7 21:07:28 2016 -0500
Account:      <myuser>
Resource:     Virtual Memory Size
Exceeded:     289 > 200 (MB)
Executable:   /opt/alt/php56/usr/bin/lsphp
Command Line: lsphp
PID:          43438 (Parent PID:30700)
Killed:       No
tried

Code:
map -x pid-of-lsphp5
no results
 

NiteWave

Administrator
#7
php script under
Account: <myuser>
has consumed 289M memory, so trigger the alert which limit is 200M.

200M limit looks too low. also 289M memory usage is not high.

if you think 289M is too high, you have to investigate <myuser>'s php script, to identify which part has caused high memory allocation. for example, if it's a wordpress site with many plugins, disable some of them to see if memory usage becomes lower.
 
#8
200M limit looks too low. also 289M memory usage is not high.
What's a reasonable size for a wordpress site in a shared environment? Perhaps I don't understand memory in this content? The whole site with plugins is less than 300 MB. I've looked for a resource to better understand the issue, but not sure what to search...
 

NiteWave

Administrator
#9
>The whole site with plugins is less than 300 MB

memory is dynamically allocated at run time, it's not related to php script's file size on hard disk.
a few lines of php script may consume 200M memory for a short while then release them.
 
#11
I am recently receiving this error. It's an Amazon Lightsail Server and hosted only one site powered by LiteSpeed.
I don't know how to fix this issue.

Code:
Time:         Sat Mar 23 12:01:39 2019 +0530
Account:      onlmineeincomeho
Resource:     Process Time
Exceeded:     5456 > 1800 (seconds)
Executable:   /opt/cpanel/ea-php72/root/usr/bin/lsphp
Command Line: lsphp                                 
PID:          22873 (Parent PID:4448)
Killed:       No
Is it a good idea to increase the time?
 
#12
To stop LFD notifications temporarily, we'll adjust memory and time limits.
Step 1: Log in to WHM.
Step 2: Go to "ConfigServer Security & Firewall" under the "Plugin" section.
Step 3: Click on "Firewall Configuration" to edit the CSF configuration file.
Step 3: Change PT_USERMEM and PT_USERTIME values.

PT_USERMEM = 512
PT_USERTIME = 1800



if you want to disable it then you can set the value to 0 on both PT_USERMEM & PT_USERTIME
 
Top