I have been trying to use MaxScale and testing it out in my Ubuntu VM. I just wanted to see it working with a simplest setup, yet I have found that MaxScale significantly lowers the throughput of the database compared to direct connection. I think it is similar to what has been discussed in this thread (https://groups.google.com/forum/#!searchin/maxscale/slow/maxscale/xYJ5LAlHtx0/yR8gRMwiOiAJ) about a year ago and the thread did not have a clear answer to the problem.
I am using MariaDB 10.0.21 and MaxScale 1.2.1. I have run tpcc benchmark with OLTPBenchmark (http://oltpbenchmark.com/wiki/index.php?title=Main_Page - site is broken atm). I just use single readconnroute with listener and nothing else. The throughput difference is about 15~20x between MaxScale and direct connection:
1) with MaxScale: Rate limited reqs/s: Results(nanoSeconds=30001768896, measuredRequests=350) = 11.665978803225297 requests/sec
2) with direct connection: Rate limited reqs/s: Results(nanoSeconds=30002113184, measuredRequests=5859) = 195.2862441411154 requests/sec
What could be the reason behind such huge overhead? Any help would be greatly appreciated. The following is the maxscale.cnf that I am currently using:
[maxscale]
threads=4
[Read Connection Router]
type=service
router=readconnroute
servers=server1
user=root
passwd=
enable_root_user=true
[Read Connection Listener]
type=listener
service=Read Connection Router
protocol=MySQLClient
port=3600
socket=/home/dyoon/maxscale/readconn.sock
[server1]
type=server
address=127.0.0.1
port=3400
protocol=MySQLBackend
Thanks,
Dong Young
I have found out what has been causing the huge overhead. It was the number of threads. It works best with 'threads=1' while previously I was testing with 'threads=4'. MaxScale starts to hog CPU as more threads are polling, which in turn degrades the performance of DBMS significantly. I guess it depends on the caliber of the system that you run MaxScale + MariaDB, but it seems to be 'threads=1' is enough for small systems. I wonder why 'maxscale_template.cnf' has 'threads=4' as the default...
FYI, the following is the throughput I get w.r.t. # of threads in MaxScale:
thread = 1
00:27:43,403 (DBWorkload.java:707) INFO - Rate limited reqs/s: Results(nanoSeconds=30000304382, measuredRequests=5067) = 168.89828634672685 requests/sec
thread = 2
00:28:35,503 (DBWorkload.java:707) INFO - Rate limited reqs/s: Results(nanoSeconds=30001305569, measuredRequests=3444) = 114.79500424003697 requests/sec
thread = 4
00:30:39,698 (DBWorkload.java:707) INFO - Rate limited reqs/s: Results(nanoSeconds=30006436827, measuredRequests=618) = 20.59558099360599 requests/sec
thread = 8
00:31:46,944 (DBWorkload.java:707) INFO - Rate limited reqs/s: Results(nanoSeconds=30001248566, measuredRequests=220) = 7.3330281410128695 requests/sec