我有一个小的OpenVZ容器。 2核和4096MB RAM。
我有mysql数据库(大小为80MB InnoDb)
当我执行100次查询时,例如INSERT ON DUPLICATE KEY UPDATE,其中很少执行超过1秒,总是
mysql> SHOW PROFILE;
+----------------------+----------+
| Status | Duration |
+----------------------+----------+
| checking permissions | 0.000040 |
| creating table | 0.000056 |
| After create | 0.011363 |
| query end | 1.231525 |
| freeing items | 0.000089 |
| logging slow query | 0.000019 |
| cleaning up | 0.000005 |
+----------------------+----------+
7 rows in set (0.00 sec)
当我关闭二进制日志记录时,它有所帮助。所以问题可能出在硬盘上。并且在查询执行期间二进制日志写入时发生。
如果我用tarantool替换mysql会有帮助吗?据我所知,tarantool也写了binlogs。
我有percona mysql
mysql> select version();
+-----------------+
| version() |
+-----------------+
| 5.6.25-73.1-log |
+-----------------+
1 row in set (0.01 sec)
这是my.cnf
[client]
default-character-set = utf8mb4
[mysql]
# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8mb4
[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid
# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP
# SAFETY #
max-allowed-packet = 16M
max-connect-errors = 1000000
# DATA STORAGE #
datadir = /var/lib/mysql/
# BINARY LOGGING #
#log-bin = /var/lib/mysql/mysql-bin
#expire-logs-days = 14
#sync-binlog = 1
# CACHES AND LIMITS #
tmp-table-size = 128M
max-heap-table-size = 128M
query-cache-type = 1
query-cache-size = 32M
max-connections = 1000
thread-cache-size = 128
open-files-limit = 65535
table-definition-cache = 1024
table-open-cache = 2048
# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-log-file-size = 256M
innodb_log_buffer_size = 32M
innodb-flush-log-at-trx-commit = 0
innodb-file-per-table = 1
innodb-buffer-pool-size = 1G
innodb_buffer_pool_instances = 1
# LOGGING #
log-error = /var/lib/mysql/mysql-error1.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log
long_query_time = 1
log-queries-not-using-indexes = 1
#PERCONA
log_slow_verbosity = microtime,query_plan,innodb
答案 0 :(得分:0)
是Tarantool写'binlogs'(WAL - 提前写入日志)。
绝对tarantool比mysql更快。 但可能mysql需要更多调优。对不起,我对mysql调优知之甚少。
答案 1 :(得分:0)
Tarantool应该帮助你。
即使启用了事务日志,它也会提供0.001秒的延迟。以下是帮助您在繁重的读/写工作负载下测试Tarantool的代码:https://gist.github.com/danikin/a5ddc6fe0cedc6257853。