嗨,我正在运行Percona Server的最新版本。
服务器版本:5.5.24-55 Percona服务器(GPL),版本26.0
我有这些特征的10 cpu盒。
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 9
model name : AMD Opteron(tm) Processor 6128
stepping : 1
microcode : 0x10000d9
cpu MHz : 800.000
cache size : 512 KB
它具有SSD和64GB RAM。Innodb大约为10GB,因此innodb_buffer_pool_size设置为10GB。
我有一张桌子,如下所示:
create table TODAY
( symbol_id integer not null
, openp decimal(10,4)
, high decimal(10,4)
, low decimal(10,4)
, last decimal(10,4) not null
, volume int
, last_updated datetime -- the time of the last quote update
, prev decimal(10,4) null
, PRIMARY KEY ( symbol_id )
)
如果我从一个空表开始并插入23,000行,则大约需要10秒钟。如果随后进行更新(每行的每一列都进行更新)(当然,symbol_id除外),则需要花费11-12秒左右的时间。
通常,这是我应该对Innodb期望的写入性能吗?有什么建议可以改善这种表现吗?更新23,000行是一个极端的情况,因为通常在一个交易日中,我需要每5秒更新大约1000行(因此,这是我要处理的更现实的约束)。
我更改了其他相关的mysql.cnf设置:
innodb_buffer_pool_size = 10G
innodb_log_file_size = 64M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
顺便说一句,如果我不是用Innodb而是用ENGINE = MEMORY创建表,则大约需要4秒钟来执行插入操作,而要花费6秒钟来进行更新。
很多TIA,如果有人可以帮助我弄清楚这种查询的基准是什么,或者帮助我缩短时间。
唐
PS完整的Innodb设置。
mysql>显示全局变量,如“ innodb%”; + ------------------------------------------- + ----- ------------------- + | 变量名| 价值| + ------------------------------------------- + ----- ------------------- + | innodb_adaptive_flushing | 开| | innodb_adaptive_flushing_method | 估计 | innodb_adaptive_hash_index | 开| | innodb_adaptive_hash_index_partitions | 1 | | innodb_additional_mem_pool_size | 8388608 | | innodb_autoextend_increment | 8 | | innodb_autoinc_lock_mode | 1 | | innodb_blocking_buffer_pool_restore | 关闭| | innodb_buffer_pool_instances | 1 | | innodb_buffer_pool_restore_at_startup | 0 | | innodb_buffer_pool_shm_checksum | 开| | innodb_buffer_pool_shm_key | 0 | | innodb_buffer_pool_size | 10737418240 | | innodb_change_buffering | 全部| | innodb_checkpoint_age_target | 0 | | innodb_checksums | 开| | innodb_commit_concurrency | 0 | | innodb_concurrency_tickets | 500 | | innodb_corrupt_table_action | 断言 | innodb_data_file_path | ibdata1:10M:autoextend | | innodb_data_home_dir | | | innodb_dict_size_limit | 0 | | innodb_doublewrite | 开| | innodb_doublewrite_file | | | innodb_fake_changes | 关闭| | innodb_fast_checksum | 关闭| | innodb_fast_shutdown | 1 | | innodb_file_format | 羚羊| | innodb_file_format_check | 开| | innodb_file_format_max | 羚羊| | innodb_file_per_table | 关闭| | innodb_flush_log_at_trx_commit | 2 | | innodb_flush_method | O_DIRECT | | innodb_flush_neighbor_pages | 面积 | innodb_force_load_corrupted | 关闭| | innodb_force_recovery | 0 | | innodb_ibuf_accel_rate | 100 | | innodb_ibuf_active_contract | 1 | | innodb_ibuf_max_size | 5368692736 | | innodb_import_table_from_xtrabackup | 0 | | innodb_io_capacity | 200 | | innodb_kill_idle_transaction | 0 | | innodb_large_prefix | 关闭| | innodb_lazy_drop_table | 0 | | innodb_lock_wait_timeout | 50 | | innodb_locks_unsafe_for_binlog | 关闭| | innodb_log_block_size | 512 | | innodb_log_buffer_size | 8388608 | | innodb_log_file_size | 67108864 | | innodb_log_files_in_group | 2 | | innodb_log_group_home_dir | ./ | | 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_page_size | 16384 | | innodb_purge_batch_size | 20 | | innodb_purge_threads | 1 | | innodb_random_read_ahead | 关闭| | innodb_read_ahead | 线性| | innodb_read_ahead_threshold | 56 | | innodb_read_io_threads | 4 | | innodb_recovery_stats | 关闭| | innodb_recovery_update_relay_log | 关闭| | innodb_replication_delay | 0 | | innodb_rollback_on_timeout | 关闭| | innodb_rollback_segments | 128 | | innodb_show_locks_held | 10 | | innodb_show_verbose_locks | 0 | | innodb_spin_wait_delay | 6 | | innodb_stats_auto_update | 1 | | innodb_stats_method | nulls_equal | | innodb_stats_on_metadata | 开| | innodb_stats_sample_pages | 8 | | innodb_stats_update_need_lock | 1 | | innodb_strict_mode | 关闭| | innodb_support_xa | 开| | innodb_sync_spin_loops | 30 | | innodb_table_locks | 开| | innodb_thread_concurrency | 0 | | 基于innodb_thread_concurrency_timer_的| 关闭| | innodb_thread_sleep_delay | 10000 | | innodb_use_global_flush_log_at_trx_commit | 开| | innodb_use_native_aio | 开| | innodb_use_sys_malloc | 开| | innodb_use_sys_stats_table | 关闭| | innodb_version | 1.1.8-rel26.0 | | innodb_write_io_threads | 4 | + ------------------------------------------- + ----- ------------------- + 设置90行(0.00秒)
我运行了numactl --hardware,这是我得到的输出。我的管理员的评论如下所述(关于解释)。
root @ prog:/ data / mysql#numactl-硬件 可用:4个节点(0-3) 节点0 cpus:0 1 2 3 节点0大小:32766 MB 节点0空闲:21480 MB 节点1 cpus:4 5 6 7 节点1大小:32768 MB 节点1免费:25285 MB 节点2 cpus:12 13 14 15 节点2大小:32768 MB 节点2免费:20376 MB 节点3 cpus:8 9 10 11 节点3大小:32768 MB 节点3免费:24898 MB 节点距离: 节点0 1 2 3 0:10 16 16 16 1:16 10 16 16 2:16 16 10 16 3:16 16 16 10