【问题标题】:Optimize MySQL setting for AWS EC2 t2.small优化 AWS EC2 t2.small 的 MySQL 设置
【发布时间】:2015-03-02 15:46:49
【问题描述】:

我有一个带有ApacheMySQL 的Web 服务器在AWS EC2 t2.smallWindows 2012 Server 上运行。 AWS EC2 t2.small特征:

  • RAM 2 GB(已使用 65%)
  • 1 CPU 2.50 GHz(已使用 1%)

现在 MySQL 进程 (mysqld.exe) 使用 400 MB 的 RAM(对我来说太多了)。

MySQL 当前设置为 (my.ini):

key_buffer                      = 16M
max_allowed_packet              = 16M
sort_buffer_size                = 512K
net_buffer_length               = 8K
read_buffer_size                = 256K
read_rnd_buffer_size            = 512K
myisam_sort_buffer_size         = 8M
tmp-table-size                  = 32M
max-heap-table-size             = 32M
max-connections                 = 500
thread-cache-size               = 50
open-files-limit                = 65535
table-definition-cache          = 1024
table-open-cache                = 2048
query_cache_type                = 1
query_cache_limit               = 256K
query_cache_min_res_unit        = 2k
query_cache_size                = 80M
innodb-log-files-in-group       = 2
innodb-log-file-size            = 64M
innodb-flush-log-at-trx-commit  = 1
innodb-file-per-table           = 1
innodb_buffer_pool_size         = 128M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size            = 5M
innodb_log_buffer_size          = 8M
innodb_flush_log_at_trx_commit  = 1
innodb_lock_wait_timeout        = 50

数据库由 20 个 InnoDB 表组成,它们由 5/10 列组成。服务器流量低。

如何优化我的设置以适合 EC2 t2.small(2GB RAM)?

【问题讨论】:

    标签: mysql amazon-web-services amazon-ec2


    【解决方案1】:

    你的配置中有两次 innodb_buffer_pool_size。它应该带有下划线,但请检查与哪一个一起使用:

    show variables like 'innodb_buffer_pool_size';
    

    您可以尝试将 innodb_buffer_pool_size 和 query_cache_size 减半。试试 query_cache_size=0 是否性能还可以。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-27
      • 1970-01-01
      • 1970-01-01
      • 2019-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多