我有一个繁忙的数据库,只有 InnoDB 表,大小约为 5GB。数据库在使用 SSD 磁盘的 Debian 服务器上运行,我设置了最大连接数 = 800,这有时会饱和并使服务器停止运行。平均每秒查询约 2.5K。所以我需要优化内存使用,为最大可能的连接腾出空间。
我已经看到建议 innodb_buffer_pool_size 应该高达总内存的 %80。另一方面,我从调整引物脚本中收到此警告:
Max Memory Ever Allocated : 91.97 G
Configured Max Per-thread Buffers : 72.02 G
Configured Max Global Buffers : 19.86 G
Configured Max Memory Limit : 91.88 G
Physical Memory : 94.58 G
Run Code Online (Sandbox Code Playgroud)
这是我当前的 innodb 变量:
| innodb_adaptive_flushing | ON |
| innodb_adaptive_hash_index | ON |
| innodb_additional_mem_pool_size | 20971520 |
| innodb_autoextend_increment | 8 |
| innodb_autoinc_lock_mode | 1 |
| innodb_buffer_pool_instances | 1 …Run Code Online (Sandbox Code Playgroud) 我有 170GB 的InnoDB索引和数据。
我必须重新调整 innodb_buffer_pool 大小以获得更好的性能。InnoDB 表(索引+数据)的最大表大小为 28GB。
那么innodb_buffer_pool的最佳大小应该是多少。
更新
我们要将我们的本地数据库迁移到 ec2,因此将根据 innodb 的当前统计数据设置 RAM,这就是为什么我需要缓冲池的大小,以便我们可以在那里拥有可用的 RAM。
文件每表已启用。
我正在使用 Linux 机器。
我只是使用了很少的 InnoDB 表(例如小于 1MB),但是在 MySQL 启动期间,它说
InnoDB: Initializing buffer pool, size = 128.0M
Run Code Online (Sandbox Code Playgroud)
是不是说我用这么小的内存,服务器还是128M内存?