【发布时间】:2015-03-02 15:46:49
【问题描述】:
我有一个带有Apache 和MySQL 的Web 服务器在AWS EC2 t2.small 和Windows 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