Fresh Installation : Requirements should list PHP memory

Found a bug? Tell us!!
Post Reply
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Fresh Installation : Requirements should list PHP memory

Post by tonyn »

The Fresh Installation Instructions Requirements section at http://www.s9y.org/36.html should list the PHP memory required as being 16 MB or so. The PHP default is 8 MB. There may be other places on the site where Requirements are listed that should also be updated. I expect that the amount of memory needed by a default new install has increased over time, and that 8 MB was enough in the past.

I know that 10 MB is not enough. I don't really know that 16 MB is enough yet, and I don't know how much memory each default plugin might require (or therefore which ones might be best ones to disable).

This is on a small 64-bit Xen slice server of 128 MB, so I won't be dramatically increasing the PHP memory.

Linux xxx 2.6.18.8-xen #1 SMP Thu Feb 14 20:34:53 UTC 2008 x86_64 x86_64 x86_64 GNU/Linux
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Fresh Installation : Requirements should list PHP memory

Post by garvinhicking »

Hi!

For core s9y installations with default plugins, 8MB is sufficient actually. My memory usage for an out-of-the-box installation is actually 4.580.536 bytes in the frontend, and 4.394.692 for the backend.

The memory requirements depends on your usage of event plugins. Your mileage may vary, we do not suggest a higher memory limit than is used for a out-of-the-box installation.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Fresh Installation : Requirements should list PHP memory

Post by garvinhicking »

Hi!

For core s9y installations with default plugins, 8MB is sufficient actually. My memory usage for an out-of-the-box installation is actually 4.580.536 bytes in the frontend, and 4.394.692 for the backend.

The memory requirements depends on your usage of event plugins. Your mileage may vary, we do not suggest a higher memory limit than is used for a out-of-the-box installation.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Post by tonyn »

I did a default installation and added no plugins . Though 8 MB was enough to install, 10 MB was required to simply proceed past the end of installation to the "empty blog" page, which was initially blank due to PHP having run out of memory. 10 MB was not enough to bring up the editor for a new blog post, but 16 MB was. I picked 10 MB and then 16 MB from searching in the S9y forums for others who have had this same problem.

Do you wish any additional information?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

This sounds a lot as if your server runs additional PHP code or PHP extensions/library?

You could edit your index.php or serendipity_admin.php file and insert "echo memory_get_usage()" at the beginning. If this ready anything other than about 200kb at start, there is definitely some code loading going on that is not caused by serendipity!

Usually you only need to raise your PHP memory limit when you install more than 4-5 event plugins.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Post by tonyn »

Adding "echo memory_get_usage()" at the top of index.php prints 357472. Note that this is on a 64-bit OS. There is currently no other use of PHP on the site. Only the default plugins are installed:

Calendar
Quicksearch
Archives
Categories
Syndicate This Blog
Blog Administration
Powered by

Markup: Serendipity
Markup: Emoticate
Markup: NL2BR
Browser Compatibility
Spam Protector

This is more than 5, but I didn't ask for them.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I personally have no 64bit OS experience...maybe in 64Bit, PHP chews up more memory?

When you add that memory_get_usage() output to the END of index.php or serendipity_admin.php, do you really get more than 8MB?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Post by tonyn »

Calling memory_get_usage() at the end of index.php prints 8429296.

FWIW, most of the memory is used "by" functions.inc.php:

before functions.inc.php: 601816
at the start of functions.inc.php: 1020128
after includes memory: 6768344
memory after functions.inc.php: 6746720

Each include used:

db memory: 136800
compat memory: 80
functions memory: 675088
plugin_api memory: 1333224
functions_images memory: 1453960
functions_installer memory: 440176
functions_entries memory: 759584
functions_comments memory: 407760
functions_permalinks memory: 233640
functions_smarty memory: 307528

This accounts for about 5.5 MB of the memory used.
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Post by tonyn »

Checking the memory on a 32-bit install shows half what a 64-bit install shows. The problem is definitely that a 64-bit install needs twice the memory of a 32-bit install. The documentation and the Installer should be updated to show this.
akremedy
Regular
Posts: 56
Joined: Sat Jul 26, 2008 9:06 am
Location: Bay Area, U.S.A.
Contact:

Post by akremedy »

I'm no expert in the many aspects of memory utilization and management in 32 vs 64 bit OS, but it's a fairly agreed upon condition that a process will consume approx 2x the amount of space in memory on a 64 bit OS than on 32 bit, due primarily to larger pointers (8 byte vs 4). There are some other nuances as well.

You may find some material around which suggests painful sounding ways to optimize PHP (as in trim out the fat and recompile) which is supposed to have a positive effect on this condition - I only know of it by reputation and can't speak any further to it.

Best Regards,
Adam
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Post by tonyn »

No, it's agreed that 64-bit applications (written in C or the equivalent) will consume about 20% more memory than their 32-bit versions. PHP applications appear to be dominated by the (minimum) size of an object, which apparently doubles from 32- to 64-bits.

This is the Bugs forum, and this is a Bug. The doubled memory for 64-bit OS needs to be documented in the Installation Requirements, and the Installer should check that both 32- and 64-bit installations have enough memory to function as installed.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

How can I detect a 64bit OS in a PHP application?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
tonyn
Regular
Posts: 10
Joined: Sun Aug 24, 2008 4:23 am
Location: Boston, MA
Contact:

Post by tonyn »

I don't know PHP well. It is trivial in Python. If PHP doesn't have a function for this, on Linux the "uname" command returns the information, and MSWindows will have something as well. Those commands can be run from PHP, and the one that works used.
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

tonyn wrote:I don't know PHP well. It is trivial in Python. If PHP doesn't have a function for this, on Linux the "uname" command returns the information, and MSWindows will have something as well. Those commands can be run from PHP, and the one that works used.
You could try

Code: Select all

<?php 
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
?>
Steve is occasionally blogging here
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Thanks a lot, I committed a new check to the s9y installer.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply