首页
学习
活动
专区
圈层
工具
发布

MySQL优化
EN

Database Administration用户
提问于 2013-02-26 12:04:47
回答 1查看 4.1K关注 0票数 1

我正在努力优化MySQL服务器,使其能够提供尽可能多的连接。

服务器位于AmazonAWS RDS中,目前有以下资源:

-7.5GB内存,4个ECU(2个虚拟核,每个2个ECU),64位平台,高I/O容量

我已经运行了一些压力测试来检查有多少连接可以提供服务,但是无论我对配置做了什么更改,mysql都不能提供超过800的服务。其余的进程将被删除。如果有人能帮忙我会很感激的。

--这些是配置中的变量:

代码语言:javascript
复制
connect_timeout=10
default_storage_engine=InnoDB
innodb_adaptive_flushing=ON
innodb_adaptive_hash_index=ON
innodb_additional_mem_pool_size=2097152
innodb_autoextend_increment=8
innodb_autoinc_lock_mode=1
innodb_buffer_pool_instances=1
innodb_buffer_pool_size=5882511360
innodb_change_buffering=all
innodb_checksums=ON
innodb_commit_concurrency=0
innodb_concurrency_tickets=500
innodb_data_file_path=ibdata1:10M:autoextend
innodb_data_home_dir=/rdsdbdata/db/innodb
innodb_doublewrite=ON
innodb_fast_shutdown=1
innodb_file_format=Antelope
innodb_file_format_check=ON
innodb_file_format_max=Antelope
innodb_file_per_table=ON
innodb_flush_log_at_trx_commit=1
innodb_flush_method=O_DIRECT
innodb_force_load_corrupted=OFF
innodb_force_recovery=0
innodb_io_capacity=200
innodb_large_prefix=OFF
innodb_locks_unsafe_for_binlog=OFF
innodb_lock_wait_timeout=50
innodb_log_buffer_size=8388608
innodb_log_files_in_group=2
innodb_log_file_size=134217728
innodb_log_group_home_dir=/rdsdbdata/log/innodb
innodb_max_dirty_pages_pct=75
innodb_max_purge_lag=0
innodb_mirrored_log_groups=1
innodb_old_blocks_pct=37
innodb_old_blocks_time=0
innodb_open_files=300
innodb_purge_batch_size=20
innodb_purge_threads=0
innodb_random_read_ahead=OFF
innodb_read_ahead_threshold=56
innodb_read_io_threads=4
innodb_replication_delay=0
innodb_rollback_on_timeout=OFF
innodb_rollback_segments=128
innodb_spin_wait_delay=6
innodb_stats_method=nulls_equal
innodb_stats_on_metadata=ON
innodb_stats_sample_pages=8
innodb_strict_mode=OFF
innodb_support_xa=ON
innodb_sync_spin_loops=30
innodb_table_locks=ON
innodb_thread_concurrency=0
innodb_thread_sleep_delay=10000
innodb_use_native_aio=ON
innodb_use_sys_malloc=ON
innodb_version=1.1.8
innodb_write_io_threads=4
lock_wait_timeout=31536000
lower_case_table_names=1
low_priority_updates=OFF
max_allowed_packet=16777216
max_binlog_cache_size=18446744073709547520
max_binlog_size=134217728
max_binlog_stmt_cache_size=18446744073709547520
max_connections=2000
max_connect_errors=10
max_delayed_threads=20
max_error_count=64
max_heap_table_size=16777216
max_insert_delayed_threads=20
max_join_size   18446744073709551615
max_length_for_sort_data=1024
max_long_data_size=16777216
max_prepared_stmt_count=16382
max_relay_log_size=0
max_seeks_for_key=18446744073709551615
max_sort_length=1024
max_sp_recursion_depth=0
max_tmp_tables=32
max_user_connections=0
max_write_lock_count=18446744073709551615
metadata_locks_cache_size=1024
min_examined_row_limit=0
multi_range_count=256
open_files_limit=65535
range_alloc_block_size=4096
read_buffer_size=262144
read_only=OFF
read_rnd_buffer_size=524288
skip_external_locking=ON
skip_name_resolve=OFF
skip_networking=OFF
skip_show_database=OFF
sort_buffer_size=2097152
storage_engine=InnoDB
stored_program_cache=256
sync_binlog=0
sync_frm=ON
sync_master_info=0
sync_relay_log=0
sync_relay_log_info=0
table_definition_cache=400
table_open_cache=2048
thread_cache_size=10240
thread_concurrency=10
thread_handling=one-thread-per-connection
thread_stack=262144
tmp_table_size=16777216
transaction_alloc_block_size=8192
transaction_prealloc_size=4096
wait_timeout=28800
warning_count=0
EN

回答 1

Database Administration用户

发布于 2013-02-26 12:57:20

回到2012年10月12日,我写了一篇文章:我什么时候应该考虑根据内存使用情况来升级RDS MySQL实例?

我给出了下面的图表

代码语言:javascript
复制
MODEL      max_connections innodb_buffer_pool_size
---------  --------------- -----------------------
t1.micro   34                326107136 (  311M)
m1-small   125              1179648000 ( 1125M,  1.097G)
m1-large   623              5882511360 ( 5610M,  5.479G)
m1-xlarge  1263            11922309120 (11370M, 11.103G)
m2-xlarge  1441            13605273600 (12975M, 12.671G)
m2-2xlarge 2900            27367833600 (26100M, 25.488G)
m2-4xlarge 5816            54892953600 (52350M, 51.123G)

这些是基于服务器模型的默认设置。我不知道自从我十月份的帖子以来,情况是否发生了变化。仅仅从图表的外观来看,除非您有服务器模型m2-2xlarge,否则由于max_connections设置为2000,我预计一些性能调优问题会有点不稳定。

建议

  • 升级到服务器模型m2-2xlargem2-4xlarge (允许更多连接)
  • 远离RDS,在Amazon EC2中使用MySQL (更多的调优独立性)
  • 调read_buffer_size,sort_buffer_size,join_buffer_size (现在没有多少回旋空间)
票数 2
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/35447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档