Jeg fik et interessant spørgsmål fra en seer af min video om virtualisering med min nye QNAP TS-563 NAS, som måske er af generel interesse.
Han spurgte om stabiliteten og performance af de virtualiserede servere er acceptabel.
Det var da egentlig et godt spørgsmål. Umiddelbart havde jeg en god mavefornemmelse: det føles som om den virtuelle server er ok hurtig. Men den slags kan man jo måle konkret, så det satte jeg mig for at gøre.
Jeg har brugt “sysbench” som er et kommandolinjeværktøj der er skræddersyet til formålet. Du kan installere det med apt-get på ubuntu og brew på OSX. Jeg ved ikke om der findes en variant til windows.
Jeg har testet tre forskellige parametre:
- CPU performance
- File I/O performance
- MYSQL transaction performance
Jeg tester min gamle server som skal pensioneres, min nye server som kører virtualiseret på NAS’en og så min core i7 iMac for at have lidt forskelligt at sammenligne med.
Resultaterne gennemgås nedenfor.
CPU benchmark
Virtual machine, 2 cores, 4 GB ram
steen@grufle5:~$ sysbench --test=cpu --cpu-max-prime=20000 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 20000 Test execution summary: total time: 26.9413s total number of events: 10000 total time taken by event execution: 26.9344 per-request statistics: min: 2.67ms avg: 2.69ms max: 2.86ms approx. 95 percentile: 2.75ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 26.9344/0.00Gamle server (FIT-PC2, Intel Atom@1.6GHz, 1 GB RAM)
steen@grufle4:~$ sysbench --test=cpu --cpu-max-prime=20000 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 20000 Test execution summary: total time: 191.4372s total number of events: 10000 total time taken by event execution: 191.4221 per-request statistics: min: 18.99ms avg: 19.14ms max: 29.10ms approx. 95 percentile: 19.22ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 191.4221/0.00Det interessante tal er “total time”, som er hhv. 26,9 ekunder og 191,4 sekunder.
Med andre ord er min virtual machine ca. 600% hurtigere end min gamle server!
Dette er per CPU core.
Tillader jeg 2 threads, er total time for min virtuelle maskine det halve (13,5) da den så udnytter begge cores. For min gamle er tallet uændret, da den kun har en core at lege med. Giver jeg min virtuelle maskine alle fire cores halveres resultatet endnu engang.
Til sammenligning er tallet 19,7 sekunder for en iMac core i7@4GHz, 16 GB ram på en enkelt core, og hvis alle 8 cores sættes i sving er tallet 3.16.
File I/O
Virtual machine
steen@grufle5:~$ sysbench --test=fileio --file-total-size=30G prepare sysbench 0.4.12: multi-threaded system evaluation benchmark 128 files, 245760Kb each, 30720Mb total Creating files for the test... steen@grufle5:~$ sysbench --test=fileio --file-total-size=30G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Initializing random number generator from timer. Extra file open flags: 0 128 files, 240Mb each 30Gb total file size Block size 16Kb Number of random requests for random IO: 0 Read/Write ratio for combined random IO test: 1.50 Periodic FSYNC enabled, calling fsync() each 100 requests. Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random r/w test Threads started! Time limit exceeded, exiting... Done. Operations performed: 25675 Read, 17116 Write, 54656 Other = 97447 Total Read 401.17Mb Written 267.44Mb Total transferred 668.61Mb (2.2287Mb/sec) 142.64 Requests/sec executed Test execution summary: total time: 300.0007s total number of events: 42791 total time taken by event execution: 159.0864 per-request statistics: min: 0.01ms avg: 3.72ms max: 57.94ms approx. 95 percentile: 11.26ms Threads fairness: events (avg/stddev): 42791.0000/0.00 execution time (avg/stddev): 159.0864/0.00 steen@grufle5:~$ steen@grufle5:~$ steen@grufle5:~$ sysbench --test=fileio --file-total-size=30G cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Removing test files... steen@grufle5:~$Gamle server (FIT-PC2, Intel Atom@1.6GHz, 1 GB RAM)
steen@grufle4:~$ sysbench --test=fileio --file-total-size=30G prepare sysbench 0.4.12: multi-threaded system evaluation benchmark 128 files, 245760Kb each, 30720Mb total Creating files for the test... steen@grufle4:~$ sysbench --test=fileio --file-total-size=30G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Initializing random number generator from timer. Extra file open flags: 0 128 files, 240Mb each 30Gb total file size Block size 16Kb Number of random requests for random IO: 0 Read/Write ratio for combined random IO test: 1.50 Periodic FSYNC enabled, calling fsync() each 100 requests. Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random r/w test Threads started! Time limit exceeded, exiting... Done. Operations performed: 13140 Read, 8760 Write, 27951 Other = 49851 Total Read 205.31Mb Written 136.88Mb Total transferred 342.19Mb (1.1406Mb/sec) 73.00 Requests/sec executed Test execution summary: total time: 300.0032s total number of events: 21900 total time taken by event execution: 186.5242 per-request statistics: min: 0.02ms avg: 8.52ms max: 100.21ms approx. 95 percentile: 19.65ms Threads fairness: events (avg/stddev): 21900.0000/0.00 execution time (avg/stddev): 186.5242/0.00 steen@grufle4:~$ steen@grufle5:~$ sysbench --test=fileio --file-total-size=30G cleanup steen@grufle5:~$: command not found steen@grufle4:~$ sysbench --test=fileio --file-total-size=30G cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Removing test files... steen@grufle4:~$Det interessante tal er her 2.2287 Mb/sec hhv. 1.1406Mb/sec.
Med andre ord er min virtual server ca. dobbelt så hurtig som min gamle server på file I/O.
Til sammenligning er file I/O på min iMac 1.355Mb/sec. Her er den virtuelle machine altså hurtigere end min iMac!
Mysql transaction performance
Virtual machine
steen@grufle5:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1139238 Server version: 5.7.12-0ubuntu1.1 (Ubuntu) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test -> ; Query OK, 1 row affected (0.08 sec) mysql> quit; Bye steen@grufle5:~$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=ditsqlpassword prepare sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Creating table 'sbtest'... Creating 1000000 records in table 'sbtest'... steen@grufle5:~$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=ditsqlpassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Running the test with following options: Number of threads: 8 Doing OLTP test. Running mixed OLTP test Doing read-only test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Threads started! Time limit exceeded, exiting... (last message repeated 7 times) Done. OLTP test statistics: queries performed: read: 417690 write: 0 other: 59670 total: 477360 transactions: 29835 (497.21 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 417690 (6960.99 per sec.) other operations: 59670 (994.43 per sec.) Test execution summary: total time: 60.0044s total number of events: 29835 total time taken by event execution: 479.7748 per-request statistics: min: 5.12ms avg: 16.08ms max: 119.61ms approx. 95 percentile: 20.11ms Threads fairness: events (avg/stddev): 3729.3750/37.15 execution time (avg/stddev): 59.9719/0.00 steen@grufle5:~$ sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=ditsqlpassword cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Dropping table 'sbtest'... Done. steen@grufle5:~$Gamle server (FIT-PC2, Intel Atom@1.6GHz, 1 GB RAM)
steen@grufle4:~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 72 Server version: 5.7.13-0ubuntu0.16.04.2 (Ubuntu) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.00 sec) mysql> quit; Bye steen@grufle4:~$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=ditsqlpassword prepare sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Creating table 'sbtest'... Creating 1000000 records in table 'sbtest'... steen@grufle4:~$ steen@grufle4:~$ steen@grufle4:~$ sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=ditsqlpassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Running the test with following options: Number of threads: 8 Doing OLTP test. Running mixed OLTP test Doing read-only test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Threads started! Time limit exceeded, exiting... (last message repeated 7 times) Done. OLTP test statistics: queries performed: read: 120008 write: 0 other: 17144 total: 137152 transactions: 8572 (142.79 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 120008 (1999.00 per sec.) other operations: 17144 (285.57 per sec.) Test execution summary: total time: 60.0339s total number of events: 8572 total time taken by event execution: 479.9789 per-request statistics: min: 14.38ms avg: 55.99ms max: 239.58ms approx. 95 percentile: 65.79ms Threads fairness: events (avg/stddev): 1071.5000/13.35 execution time (avg/stddev): 59.9974/0.01 steen@grufle4:~$ steen@grufle4:~$ sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=ditsqlpassword cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark No DB drivers specified, using mysql Dropping table 'sbtest'... Done. steen@grufle4:~$Det interessante tal er transactions per sekund, som er 497.21 hhv. 142.79. Her er min virtual server altså ca. 4 gange så hurtig som den gamle server.
Men iMac’en slår dem begge med stor margin (3442.72), da mysqld på iMac’en udnytter alle 8 cores.
Så konklusionen er, at min QNAP TS-563 leverer en ganske respektabel performance. Den overgår nemt min gamle server, men det burde den nu også gøre. Performance er rigelig til mine formål.
Indtil videre har jeg heller ikke oplevet stabilitetsproblemer. Min ubuntu server har kørt klippestabilt siden jeg startede den første gang, men det er ret beset lidt tidligt at konkludere på stabilitet.
I skrivende stund har mit VM setup kørt 24-7 i en måneds tid. Hvis jeg husker det, så laver jeg en opfølgning om et halvt års tid.
UPDATE – Næsten et år senere:
Jeg har nu haft 3-5 servere kørende klippestabilt i næsten et år. Jeg har overhovedet ikke oplevet problemer, så jeg er fortsat meget tilfreds.
UPDATE – 2 år senere:
Jeg har nu haft denne NAS i drift i noget der ligner 3 år. Den har kørt fuldstændig upåklageligt. Alle virtual machines virker også klippestabilt. Jeg er meget tilfreds!
Hej Steen
Jeg har med interesse set dine videoer om dine QNAP-servere.
Jeg har et spørgsmål:
Hvad er det der gør, at du kan lide QNAP’s servere frem for andre servere?
Hej Hans,
Jeg ved ikke om jeg vil sige “frem for andre”. Jeg valgte i sin tid en Qnap NAS (TS639) på baggrund af en række anmeldelser jeg læste på nettet. Jeg har været glad for den, så da jeg fik brug for at udvide maskinparken med endnu en NAS var det naturligt for mig at honorere min tilfredshed (specielt med at Qnap fortsat understøtter min gamle NAS – 8 år efter den udgik af deres sortiment med software opdateringer) ved at købe endnu et produkt fra dem.
Jeg er for så vidt ret sikker på at jeg ville få et tilsvarende godt produkt fra f.eks. Synology.
Tak for dit svar og dine videoer.