Reducing memory consumption of mysql on ubuntu@aws micro instance

前端 未结 4 810
-上瘾入骨i
-上瘾入骨i 2021-01-30 03:13

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.

4条回答
  •  你的背包
    2021-01-30 03:40

    I have a server with only 500mb ram and found that mysql started using a lot of ram as my tables got larger. After playing with a bunch of the settings, what reduced memory usage for me was to convert all my tables to MyISAM. If you dont need the features of innodb converting tables to MyISAM helps quite a bit. You can convert tables like this :

    ALTER TABLE test.mytable ENGINE=MyISAM;
    

    After this change I found that memory usage decreased by 20%. To get a further reduction in memory usage you can convert ALL of your tables to MyISAM and then turn off innodb support in mysql altogether. This reduced my memory usage by 50%.

    You can do this by adding :

    [mysqld]
    default_storage_engine=myisam
    innodb=OFF
    

    and then restarting mysql.

提交回复
热议问题