Answers.Body: <p>I would say it's your smart groups causing the problem. They get recalculated a lot and this can use a lot of RAM. </p>
  
  <p>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.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-26T22:01:05.297Z
Answers.Text: 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.
Answers.UserDisplayName: themak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-26T13:27:34.513Z
Answers.LastActivityDate: 2018-09-26T13:27:34.513Z
Answers.UserDisplayName: naomi
Answers.Body: <p>What are your settings for /etc/mysql/my.cnf and what's running your webserver (NGINX or Apache2)?</p>
  
  <p>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?</p>
  
  <p>Generally a 2 GB RAM instance should sufficiently power a small CiviCRM instance as the one you're describing with no hiccups.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-07T21:38:20.307Z
Answers.LastActivityDate: 2017-05-07T21:38:20.307Z
Answers.UserDisplayName: Young-Jin Kim
Answers.Body: <p>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.</p>
  
  <p>[My personal POV is that RAM is cheap, so put it on something that isn't a smart watch.]</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-20T01:19:57.500Z
Answers.LastActivityDate: 2017-05-20T01:19:57.500Z
Answers.UserDisplayName: JohnFF
Body: <p>We have AmazonAWS <a href="https://aws.amazon.com/ec2/instance-types/" rel="nofollow noreferrer">t2.micro server</a> (free tier). T2. micro has 1 Gb of ram and 1 vCPU. Only CiviCRM (4.7.14) is hosted there along with its Drupal.</p>
  
  <p>Currently the database is very small (less than 5000 contacts). Once a day we request <strong>Cron</strong> 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).</p>
  
  <p>With this setup MySQL is sometimes running out of memory. Could it be wrong <strong>settings</strong> or 1Gb is just not enough?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-07T07:02:51.023Z
Comments.Text: When is SQL running out of memory? What error message specifically are you getting?
Comments.UserDisplayName: Allen Hutchison
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-05-07T07:17:55.263Z
Comments.Text: It could be either. See also [this similar question](https://civicrm.stackexchange.com/questions/18355/is-civicrm-resource-intensive/18356#18356). 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.)
Comments.UserDisplayName: Chris Burgess
Tags: <mysql><core><performance>
Title: Is 1Gb memory enough for small server?
ThreadText: # Is 1Gb memory enough for small server?
  
  (Asked by: username_0 on 2017-05-07)
  
  We have AmazonAWS [t2.micro server](https://aws.amazon.com/ec2/instance-types/) (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?
  
  **Tags:** mysql, core, performance
  
  > **Comments:**
  > **username_1**: When is SQL running out of memory? What error message specifically are you getting?  
  > **username_2**: It could be either. See also [this similar question](https://civicrm.stackexchange.com/questions/18355/is-civicrm-resource-intensive/18356#18356). 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.)  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2018-09-26. Score: 1
  
  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.
  
  > **Comments:**
  > **username_4**: 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.  
  
  ---
  
  ### Answer by username_5 on 2017-05-07. Score: 0
  
  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.
  
  
  ---
  
  ### Answer by username_6 on 2017-05-20. Score: 0
  
  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.]
  
  
  ---
  
  