0

I have a small OpenVZ container. 2 cores and 4096MB RAM.

I have mysql database (overal size is 80MB InnoDb)

When i do 100 queries like INSERT ON DUPLICATE KEY UPDATE, few of them executes longer than 1 seconds, always

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)

When i turned off binary logging, it helped. So the problem maybe in hard drive. And occurs when binary log is writing during the query executing.

Will it help, if i replace mysql with the tarantool? As i know tarantool also writes binlogs.

I have percona mysql

mysql> select version();
+-----------------+
| version()       |
+-----------------+
| 5.6.25-73.1-log |
+-----------------+
1 row in set (0.01 sec)

Here is the 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

2 Answers2

0

Yes Tarantool write 'binlogs' (WAL - write-ahead logging).

Definitely tarantool are more faster than mysql. But probably mysql need more tuning. Sorry I'm not know much about mysql tuning.

0

Tarantool should help you out here.

It delivers sub 0.001s latencies even with transaction log turned on. Here is the piece of code that helps you testing Tarantool under heavy read/write workloads: https://gist.github.com/danikin/a5ddc6fe0cedc6257853.

Dennis Anikin
  • 961
  • 5
  • 7
  • [root@vps13717 tar_test]# ./tar_test 127.0.0.1:3301 write 3 10000000 Requests per second: 563789, Responses per second: 515994, Pending requests: 47795, Latency: 92.627046 ms Looks awesome! – Frenky Andrey Mar 23 '16 at 12:08
  • Oh yeah! :-) It has enough spare CPU time for almost any workload. So you can use that CPU time to run an application server on the same node as a database server. In fact you can use Tarantool as an application server as well. – Dennis Anikin Mar 23 '16 at 22:35