LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   Install/Configuration (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=11)
-   -   litespeed PHP memory_limit not being recognised ?? (http://www.litespeedtech.com/support/forum/showthread.php?t=3782)

eva2000 02-11-2010 04:09 PM

litespeed PHP memory_limit not being recognised ??
 
Hi

I seem to be stumped on a PHP memory_limit exceeded message of which the usual php.ini edits have no use.

I've edited

/usr/local/lib/php.ini
/usr/local/lsws/php/php.ini

Both to memory_limit = 256 and restarted lightspeed but still stuck around max 32-37MB for php ? Is this because php was compiled without memory-limit flag ?

PHPINFO reports 256M memory_limit

Code:

memory_limit        256M        256M
configure command

Quote:

./configure --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zip --prefix=/usr/local --with-bz2 --with-curl=/opt/curlssl/ --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mhash=/opt/mhash/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-openssl=/usr --with-openssl-dir=/usr --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-ttf --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr --with-litespeed
but using test script as well as in drupal 5.19 and vbdrupal 5.19 scripts I am hitting memory_limit at around 32-37MB ??

test script output

Quote:

Expected memory limit 256MB
Base -> 93616 (0.09 MB)

Clear -> 103912 (0.1 MB)
1000 x 10000 chars -> 10104072 (9.64 MB) [15.1 percent]
Clear -> 104096 (0.1 MB)
1500 x 10000 chars -> 15104256 (14.4 MB) [22.5 percent]
Clear -> 104096 (0.1 MB)
2000 x 10000 chars -> 20104256 (19.17 MB) [30 percent]
Clear -> 104096 (0.1 MB)
2500 x 10000 chars -> 25104256 (23.94 MB) [37.4 percent]
Clear -> 104096 (0.1 MB)
3000 x 10000 chars -> 30104256 (28.71 MB) [44.9 percent]
Clear -> 104096 (0.1 MB)
3500 x 10000 chars -> 35104256 (33.48 MB) [52.3 percent]
Clear -> 104096 (0.1 MB)
4000 x 10000 chars ->
Fatal error: Out of memory (allocated 262144) (tried to allocate 40000001 bytes) in /home/username/public_html/phpmemory.php on line 19
phpmemory.php script contents

Code:

<?php
// phpmemory.php

$memlimit = 256;
print 'Expected memory limit ' . $memlimit . 'MB <br />';

$memory_mb = round(memory_get_usage() /1024/1024 , 2);
print 'Base  -> ' . memory_get_usage() . ' (' . $memory_mb . ' MB)' . ' <br /> &ensp; <br />';

$pattern = str_repeat("0123456789", 1000);
$fill = str_repeat($pattern, 1);
$counter = 1000;
while ( $counter <= 27000 ) {
    unset($fill);
    $memory_mb = round(memory_get_usage() /1024/1024 , 2);
    print 'Clear -> ' . memory_get_usage() . ' (' . $memory_mb . ' MB) <br />';

    print $counter . ' x 10000 chars -> ' ;
    $fill = str_repeat($pattern, $counter);
    $memory_mb = round(memory_get_usage() /1024/1024 , 2);
    print  memory_get_usage() . ' (' . $memory_mb . ' MB)'. ' [' . $memory_pct = round($memory_mb /
$memlimit *100 , 1) . ' percent]<br />';
    $counter = $counter + 500;
}
print '<br />If you can see this, the server can allocate something close to 256mb';
?>

So is there are php memory limit in litespeed elsewhere that needs editing ? I tried copying php.ini over to /home/username as well and that didn't work either ?

If php needs to be recompiled with memory limit flag, where do I recompile it from litespeed admin for web1 and web2 servers or from WHM easyapache ?

Rest of details:

On WHM/Cpanel 11.25.xx based server with litespeed 4.0.12 on 2x web servers load balanced using haproxy where load balancer ip is xxx.xx.xxx.x13

Both web1 and web2 have:
  • PHP 5.2.12 + Eaccelerator
  • Memcached 1.2.8 and Memache 2.2.5 installed

thanks

George

mistwang 02-11-2010 04:19 PM

There is a memory limit configuration for lsphp5 external application, login to LSWS web console and check.

eaccelerator memory is counted towards that limit.

eva2000 02-12-2010 02:51 AM

Ah didn't know eccelerator memory is counted too !

is that eaccelerator actual used memory or the max limit defined for eaccelerator that is counted ?

thanks

mistwang 02-12-2010 12:01 PM

eaccelerator always allocate SHM/MMAP memory all at once at beginning.

eva2000 02-13-2010 02:35 AM

eaccelerator was set at 256MB

seems the soft/hard php5 limits in litespeed admin were 400M but I didn't know they were in bytes.. thought it was megabytes, so upped it to 2560 and it worked.

eva2000 02-13-2010 02:38 AM

working with soft/hard limit at 1280 and 2560

Quote:

Expected memory limit 256MB
Base -> 79272 (0.08 MB)

Clear -> 89568 (0.09 MB)
1000 x 10000 chars -> 10089728 (9.62 MB) [3.8 percent]
Clear -> 89752 (0.09 MB)
1225 x 10000 chars -> 12339912 (11.77 MB) [4.6 percent]
Clear -> 89752 (0.09 MB)
1450 x 10000 chars -> 14589912 (13.91 MB) [5.4 percent]
Clear -> 89752 (0.09 MB)
1675 x 10000 chars -> 16839912 (16.06 MB) [6.3 percent]
Clear -> 89752 (0.09 MB)
1900 x 10000 chars -> 19089912 (18.21 MB) [7.1 percent]
Clear -> 89752 (0.09 MB)
2125 x 10000 chars -> 21339912 (20.35 MB) [7.9 percent]
Clear -> 89752 (0.09 MB)
2350 x 10000 chars -> 23589912 (22.5 MB) [8.8 percent]
Clear -> 89752 (0.09 MB)
2575 x 10000 chars -> 25839912 (24.64 MB) [9.6 percent]
Clear -> 89752 (0.09 MB)
2800 x 10000 chars -> 28089912 (26.79 MB) [10.5 percent]
Clear -> 89752 (0.09 MB)
3025 x 10000 chars -> 30339912 (28.93 MB) [11.3 percent]
Clear -> 89752 (0.09 MB)
3250 x 10000 chars -> 32589912 (31.08 MB) [12.1 percent]
Clear -> 89752 (0.09 MB)
3475 x 10000 chars -> 34839912 (33.23 MB) [13 percent]
Clear -> 89752 (0.09 MB)
3700 x 10000 chars -> 37089912 (35.37 MB) [13.8 percent]
Clear -> 89752 (0.09 MB)
3925 x 10000 chars -> 39339912 (37.52 MB) [14.7 percent]
Clear -> 89752 (0.09 MB)
4150 x 10000 chars -> 41589912 (39.66 MB) [15.5 percent]
Clear -> 89752 (0.09 MB)
4375 x 10000 chars -> 43839912 (41.81 MB) [16.3 percent]
Clear -> 89752 (0.09 MB)
4600 x 10000 chars -> 46089912 (43.95 MB) [17.2 percent]
Clear -> 89752 (0.09 MB)
4825 x 10000 chars -> 48339912 (46.1 MB) [18 percent]
Clear -> 89752 (0.09 MB)
5050 x 10000 chars -> 50589912 (48.25 MB) [18.8 percent]
Clear -> 89752 (0.09 MB)
5275 x 10000 chars -> 52839912 (50.39 MB) [19.7 percent]
Clear -> 89752 (0.09 MB)
5500 x 10000 chars -> 55089912 (52.54 MB) [20.5 percent]
Clear -> 89752 (0.09 MB)
5725 x 10000 chars -> 57339912 (54.68 MB) [21.4 percent]
Clear -> 89752 (0.09 MB)
5950 x 10000 chars -> 59589912 (56.83 MB) [22.2 percent]
Clear -> 89752 (0.09 MB)
6175 x 10000 chars -> 61839912 (58.98 MB) [23 percent]
Clear -> 89752 (0.09 MB)
6400 x 10000 chars -> 64089912 (61.12 MB) [23.9 percent]
Clear -> 89752 (0.09 MB)
6625 x 10000 chars -> 66339912 (63.27 MB) [24.7 percent]
Clear -> 89752 (0.09 MB)
6850 x 10000 chars -> 68589912 (65.41 MB) [25.6 percent]
Clear -> 89752 (0.09 MB)
7075 x 10000 chars -> 70839912 (67.56 MB) [26.4 percent]
Clear -> 89752 (0.09 MB)
7300 x 10000 chars -> 73089912 (69.7 MB) [27.2 percent]
Clear -> 89752 (0.09 MB)
7525 x 10000 chars -> 75339912 (71.85 MB) [28.1 percent]
Clear -> 89752 (0.09 MB)
7750 x 10000 chars -> 77589912 (74 MB) [28.9 percent]
Clear -> 89752 (0.09 MB)
7975 x 10000 chars -> 79839912 (76.14 MB) [29.7 percent]
Clear -> 89752 (0.09 MB)
8200 x 10000 chars -> 82089912 (78.29 MB) [30.6 percent]
Clear -> 89752 (0.09 MB)
8425 x 10000 chars -> 84339912 (80.43 MB) [31.4 percent]
Clear -> 89752 (0.09 MB)
8650 x 10000 chars -> 86589912 (82.58 MB) [32.3 percent]
Clear -> 89752 (0.09 MB)
8875 x 10000 chars -> 88839912 (84.72 MB) [33.1 percent]
Clear -> 89752 (0.09 MB)
9100 x 10000 chars -> 91089912 (86.87 MB) [33.9 percent]
Clear -> 89752 (0.09 MB)
9325 x 10000 chars -> 93339912 (89.02 MB) [34.8 percent]
Clear -> 89752 (0.09 MB)
9550 x 10000 chars -> 95589912 (91.16 MB) [35.6 percent]
Clear -> 89752 (0.09 MB)
9775 x 10000 chars -> 97839912 (93.31 MB) [36.4 percent]
Clear -> 89752 (0.09 MB)
10000 x 10000 chars -> 100089912 (95.45 MB) [37.3 percent]
Clear -> 89752 (0.09 MB)
10225 x 10000 chars -> 102339912 (97.6 MB) [38.1 percent]
Clear -> 89752 (0.09 MB)
10450 x 10000 chars -> 104589912 (99.74 MB) [39 percent]
Clear -> 89752 (0.09 MB)
10675 x 10000 chars -> 106839912 (101.89 MB) [39.8 percent]
Clear -> 89752 (0.09 MB)
10900 x 10000 chars -> 109089912 (104.04 MB) [40.6 percent]
Clear -> 89752 (0.09 MB)
11125 x 10000 chars -> 111339912 (106.18 MB) [41.5 percent]
Clear -> 89752 (0.09 MB)
11350 x 10000 chars -> 113589912 (108.33 MB) [42.3 percent]
Clear -> 89752 (0.09 MB)
11575 x 10000 chars -> 115839912 (110.47 MB) [43.2 percent]
Clear -> 89752 (0.09 MB)
11800 x 10000 chars -> 118089912 (112.62 MB) [44 percent]
Clear -> 89752 (0.09 MB)
12025 x 10000 chars -> 120339912 (114.77 MB) [44.8 percent]
Clear -> 89752 (0.09 MB)
12250 x 10000 chars -> 122589912 (116.91 MB) [45.7 percent]
Clear -> 89752 (0.09 MB)
12475 x 10000 chars -> 124839912 (119.06 MB) [46.5 percent]
Clear -> 89752 (0.09 MB)
12700 x 10000 chars -> 127089912 (121.2 MB) [47.3 percent]
Clear -> 89752 (0.09 MB)
12925 x 10000 chars -> 129339912 (123.35 MB) [48.2 percent]
Clear -> 89752 (0.09 MB)
13150 x 10000 chars -> 131589912 (125.49 MB) [49 percent]
Clear -> 89752 (0.09 MB)
13375 x 10000 chars -> 133839912 (127.64 MB) [49.9 percent]
Clear -> 89752 (0.09 MB)
13600 x 10000 chars -> 136089912 (129.79 MB) [50.7 percent]
Clear -> 89752 (0.09 MB)
13825 x 10000 chars -> 138339912 (131.93 MB) [51.5 percent]
Clear -> 89752 (0.09 MB)
14050 x 10000 chars -> 140589912 (134.08 MB) [52.4 percent]
Clear -> 89752 (0.09 MB)
14275 x 10000 chars -> 142839912 (136.22 MB) [53.2 percent]
Clear -> 89752 (0.09 MB)
14500 x 10000 chars -> 145089912 (138.37 MB) [54.1 percent]
Clear -> 89752 (0.09 MB)
14725 x 10000 chars -> 147339912 (140.51 MB) [54.9 percent]
Clear -> 89752 (0.09 MB)
14950 x 10000 chars -> 149589912 (142.66 MB) [55.7 percent]
Clear -> 89752 (0.09 MB)
15175 x 10000 chars -> 151839912 (144.81 MB) [56.6 percent]
Clear -> 89752 (0.09 MB)
15400 x 10000 chars -> 154089912 (146.95 MB) [57.4 percent]
Clear -> 89752 (0.09 MB)
15625 x 10000 chars -> 156339912 (149.1 MB) [58.2 percent]
Clear -> 89752 (0.09 MB)
15850 x 10000 chars -> 158589912 (151.24 MB) [59.1 percent]
Clear -> 89752 (0.09 MB)
16075 x 10000 chars -> 160839912 (153.39 MB) [59.9 percent]
Clear -> 89752 (0.09 MB)
16300 x 10000 chars -> 163089912 (155.53 MB) [60.8 percent]
Clear -> 89752 (0.09 MB)
16525 x 10000 chars -> 165339912 (157.68 MB) [61.6 percent]
Clear -> 89752 (0.09 MB)
16750 x 10000 chars -> 167589912 (159.83 MB) [62.4 percent]
Clear -> 89752 (0.09 MB)
16975 x 10000 chars -> 169839912 (161.97 MB) [63.3 percent]
Clear -> 89752 (0.09 MB)
17200 x 10000 chars -> 172089912 (164.12 MB) [64.1 percent]
Clear -> 89752 (0.09 MB)
17425 x 10000 chars -> 174339912 (166.26 MB) [64.9 percent]
Clear -> 89752 (0.09 MB)
17650 x 10000 chars -> 176589912 (168.41 MB) [65.8 percent]
Clear -> 89752 (0.09 MB)
17875 x 10000 chars -> 178839912 (170.56 MB) [66.6 percent]
Clear -> 89752 (0.09 MB)
18100 x 10000 chars -> 181089912 (172.7 MB) [67.5 percent]
Clear -> 89752 (0.09 MB)
18325 x 10000 chars -> 183339912 (174.85 MB) [68.3 percent]
Clear -> 89752 (0.09 MB)
18550 x 10000 chars -> 185589912 (176.99 MB) [69.1 percent]
Clear -> 89752 (0.09 MB)
18775 x 10000 chars -> 187839912 (179.14 MB) [70 percent]
Clear -> 89752 (0.09 MB)
19000 x 10000 chars -> 190089912 (181.28 MB) [70.8 percent]
Clear -> 89752 (0.09 MB)
19225 x 10000 chars -> 192339912 (183.43 MB) [71.7 percent]
Clear -> 89752 (0.09 MB)
19450 x 10000 chars -> 194589912 (185.58 MB) [72.5 percent]
Clear -> 89752 (0.09 MB)
19675 x 10000 chars -> 196839912 (187.72 MB) [73.3 percent]
Clear -> 89752 (0.09 MB)
19900 x 10000 chars -> 199089912 (189.87 MB) [74.2 percent]
Clear -> 89752 (0.09 MB)
20125 x 10000 chars -> 201339912 (192.01 MB) [75 percent]
Clear -> 89752 (0.09 MB)
20350 x 10000 chars -> 203589912 (194.16 MB) [75.8 percent]
Clear -> 89752 (0.09 MB)
20575 x 10000 chars -> 205839912 (196.3 MB) [76.7 percent]
Clear -> 89752 (0.09 MB)
20800 x 10000 chars -> 208089912 (198.45 MB) [77.5 percent]
Clear -> 89752 (0.09 MB)
21025 x 10000 chars -> 210339912 (200.6 MB) [78.4 percent]
Clear -> 89752 (0.09 MB)
21250 x 10000 chars -> 212589912 (202.74 MB) [79.2 percent]
Clear -> 89752 (0.09 MB)
21475 x 10000 chars -> 214839912 (204.89 MB) [80 percent]
Clear -> 89752 (0.09 MB)
21700 x 10000 chars -> 217089912 (207.03 MB) [80.9 percent]
Clear -> 89752 (0.09 MB)
21925 x 10000 chars -> 219339912 (209.18 MB) [81.7 percent]
Clear -> 89752 (0.09 MB)
22150 x 10000 chars -> 221589912 (211.32 MB) [82.5 percent]
Clear -> 89752 (0.09 MB)
22375 x 10000 chars -> 223839912 (213.47 MB) [83.4 percent]
Clear -> 89752 (0.09 MB)
22600 x 10000 chars -> 226089912 (215.62 MB) [84.2 percent]
Clear -> 89752 (0.09 MB)
22825 x 10000 chars -> 228339912 (217.76 MB) [85.1 percent]
Clear -> 89752 (0.09 MB)
23050 x 10000 chars -> 230589912 (219.91 MB) [85.9 percent]
Clear -> 89752 (0.09 MB)
23275 x 10000 chars -> 232839912 (222.05 MB) [86.7 percent]
Clear -> 89752 (0.09 MB)
23500 x 10000 chars -> 235089912 (224.2 MB) [87.6 percent]
Clear -> 89752 (0.09 MB)
23725 x 10000 chars -> 237339912 (226.34 MB) [88.4 percent]
Clear -> 89752 (0.09 MB)
23950 x 10000 chars -> 239589912 (228.49 MB) [89.3 percent]
Clear -> 89752 (0.09 MB)
24175 x 10000 chars -> 241839912 (230.64 MB) [90.1 percent]
Clear -> 89752 (0.09 MB)
24400 x 10000 chars -> 244089912 (232.78 MB) [90.9 percent]
Clear -> 89752 (0.09 MB)
24625 x 10000 chars -> 246339912 (234.93 MB) [91.8 percent]
Clear -> 89752 (0.09 MB)
24850 x 10000 chars -> 248589912 (237.07 MB) [92.6 percent]
Clear -> 89752 (0.09 MB)
25075 x 10000 chars -> 250839912 (239.22 MB) [93.4 percent]
Clear -> 89752 (0.09 MB)
25300 x 10000 chars -> 253089912 (241.37 MB) [94.3 percent]
Clear -> 89752 (0.09 MB)
25525 x 10000 chars -> 255339912 (243.51 MB) [95.1 percent]
Clear -> 89752 (0.09 MB)
25750 x 10000 chars -> 257589912 (245.66 MB) [96 percent]
Clear -> 89752 (0.09 MB)
25975 x 10000 chars -> 259839912 (247.8 MB) [96.8 percent]
Clear -> 89752 (0.09 MB)
26200 x 10000 chars -> 262089912 (249.95 MB) [97.6 percent]
Clear -> 89752 (0.09 MB)
26425 x 10000 chars -> 264339912 (252.09 MB) [98.5 percent]
Clear -> 89752 (0.09 MB)
26650 x 10000 chars -> 266589912 (254.24 MB) [99.3 percent]
Clear -> 89752 (0.09 MB)
26875 x 10000 chars ->
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 268750001 bytes) in /home/username/public_html/phpmemory.php on line 19

anewday 02-13-2010 07:16 AM

Quote:

Originally Posted by eva2000 (Post 18626)
eaccelerator was set at 256MB

seems the soft/hard php5 limits in litespeed admin were 400M but I didn't know they were in bytes.. thought it was megabytes, so upped it to 2560 and it worked.

You can add a M for megabytes, which is the default.

Like 300M

eva2000 02-13-2010 08:26 AM

1 Attachment(s)
thats what was set in soft hard limits by default = 400M

had to change it to 2560M to get to 256MB php.ini limit

mistwang 02-18-2010 10:09 AM

If eAccelerator is configured to use 256MB, the soft limit should be set above 512MB to leave 256MB for normal PHP usages. I think 600M should be enough by giving some head room.

eva2000 02-25-2010 09:59 PM

hi having a problem now flowing on from original problem listed above.

1. eaccelerator using 256MB assigned value

2. now using above test script and drupal errors originally couldn't use more than 40MB when soft and hard limits were set to 400M by PHP5 external handler and memory_limit in php.ini set to 256MB

3. raising the value to soft limits and hard limits of 1280M and 2560M allowed me to fix the script and drupal related memory exceeded limits of 37-40MB, BUT now the servers are getting 503 service unavailable messages maybe due to high soft/hard memory limits in PHP5 external handler ??? So is this a bug that 1280-2560M is needed to get 256M memory_limit to work ??

4. Also we have memcache/memcached compiled and loaded memcache.so into php.ini. Memcached server set to allocate 128MB. Now found out php.ini had memcache.so loaded twice giving the below error message. Would this also drive up php memory usage to the point of 503 service unavailable messages ?

Quote:

Module 'memcache' already loaded in Unknown on line 0


All times are GMT -7. The time now is 04:46 PM.