Search code examples
memory-managementamazon-ec2amazon-web-servicesmysql

Reducing memory consumption of mysql on ubuntu@aws micro instance


I have recently started on a PoC project wherein we are developing a small web app. The initial setup is done on a micro instance from AWS. We are on rails+mysql stack.

After installing/running MySQL, I see that about 500+ MB RAM has been consumed already; leaving quite less for rest of the systems (micro instances have barely 620 MB RAM).

Our app is fairly simple at this stage. Can I do something to reduce the memory consumed by MySQL server?

Appreciate the help.


Solution

  • Change this setting in the MySQL configuration file (my.cnf)

    key_buffer              = 8M 
    max_connections         = 30 # Limit connections
    query_cache_size        = 8M # try 4m if not enough 
    query_cache_limit       = 512K
    thread_stack            = 128K