We have AmazonAWS t2.micro server (free tier). T2. micro has 1 Gb of ram and 1 vCPU. Only CiviCRM (4.7.14) is hosted there along with its Drupal.

Currently the database is very small (less than 5000 contacts). Once a day we request Cron to email 6-8 reports (e.g., all contacts, contributions in last 3 years, etc.). The summary daily traffic seems to be below 10Mb. Other than that there are some Smart groups (100-200).

With this setup MySQL is sometimes running out of memory. Could it be wrong settings or 1Gb is just not enough?

  • When is SQL running out of memory? What error message specifically are you getting? Commented May 7, 2017 at 7:02
  • 1
    It could be either. See also this similar question. 5000 is not a lot of contacts, 1-200 is quite a lot of smart groups. You know your server is hitting resource limits; you could either debug to identify the cause, or just bump up your available resources and see if it stops. (Even when it does stop hitting limits, from there you want to scale for success, not just survival.) Commented May 7, 2017 at 7:17

3 Answers 3


I would say it's your smart groups causing the problem. They get recalculated a lot and this can use a lot of RAM.

Are you sure MySQL is running out of memory, rather than getting deadlocks? Deadlocks are also a problem that can occur when you are using a lot of smart groups.

I would recommend upgrading the RAM anyway, because it is bound to make everything smoother. 1GB is very small. You may find it fixes your problem instantly, and then the money is well spent. But if that doesn't help, or you get other MySQL-related problems, I would suggest trying to cut down on smart groups if you can.

  • I bet its the smart groups too - I bet if you disabled the smart group cron and ran your daily report - it would be fine.
    – themak
    Commented Oct 26, 2018 at 22:01

What are your settings for /etc/mysql/my.cnf and what's running your webserver (NGINX or Apache2)?

Generally you want to give about 60% of available RAM to MySQL and the rest to Apache2. Check if you have bin-log enable in MySQL, which can increase your RAM usage. What's the behavior that you see when MySQL runs out of memory? Does mysql stop, or do you get a WSOD or an error message from PDO in Drupal?

Generally a 2 GB RAM instance should sufficiently power a small CiviCRM instance as the one you're describing with no hiccups.


An anecdote, but I put an install on Digital Ocean's cheapest server (512MB RAM) and kept having to restart it due to MySQL crashing due to lack of memory. I upgraded to a 1GB Droplet and haven't had to since.

[My personal POV is that RAM is cheap, so put it on something that isn't a smart watch.]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.