Unclear what the best strategy is for memory_limit (Ubuntu/PHP/Drupal/CiviCRM)

Running a stack with PHP, Drupal, and CiviCRM, each of which allows for setting hard memory limits. The docs I've read indicate that this combination wants a limit of 256 megs for PHP, Drupal doesn't recommend one, and CiviCRM's docs say 64 is fine for it.

But out of the box, my configuration had PHP at 128, and unlimited for Drupal and CiviCRM. I had to monkey with these last night (Civi was trying to eat all available RAM at launch), but having resolved the problem it's now PHP 256, unlimited, unlimited.

I've got 4,096 to play with. Is there any reason to set the other limits? Or even to limit PHP in the first place? I'm not sure if any of these refer to per-thread or entire-instance.

1 Reply

Linode Staff

This is an interesting question. I did some looking into it and it seems like you are on the right track to set a limit for PHP. PHP is pretty notorious for using up a lot of memory, especially because it can create a number of extra processes.

If I were in your shoes, I would want to get a handle on how much memory Drupal and CiviCRM are going to use if there isn't an explicit limit set on them. To do so I'd set up a cron job that just runs something like

top -bn 1 >> top.txt

Every 5 minutes or so. This will give you one file that contains all those outputs. You can then grep for the IDs of Drupal, CiviCRM and PHP to see how much memory they are all using, how it compares to your total and how it changes based on traffic. To keep track of traffic I would just keep an eye on the bandwidth graphs but there are a lot of powerful tools that can help you.

There are probably more elegant ways to accomplish the same task, so you can take it with a grain of salt.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct