Lightsailで契約しているホストのCPU性能がどうも遅いので簡単に試験してみることにしました。契約しているのはLightsailの月10ドルプランです。ベンチマークにはaptでインストールできる sysbench を用います。
以下のコマンドでインストールします。
$ sudo apt install sysbench
[sudo] password for user:
Reading package lists... Done
インストールができたら、以下のコマンドで実行できます。
$ sysbench --test=cpu run
実行してみる
AWS10ドルプランサーバーで実行してみます。–threadsでスレッド数の指定ができます。
$ sysbench --test=cpu --threads=1 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 863.31
General statistics:
total time: 10.0011s
total number of events: 8636
Latency (ms):
min: 1.07
avg: 1.16
max: 4.60
95th percentile: 1.18
sum: 9983.82
Threads fairness:
events (avg/stddev): 8636.0000/0.00
execution time (avg/stddev): 9.9838/0.00
4スレッドにした場合
$ sysbench --test=cpu --threads=4 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.11 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 859.44
General statistics:
total time: 10.0023s
total number of events: 8598
Latency (ms):
min: 1.14
avg: 4.64
max: 45.43
95th percentile: 13.22
sum: 39908.72
Threads fairness:
events (avg/stddev): 2149.5000/4.39
execution time (avg/stddev): 9.9772/0.02
CPUスピードの値がほぼ変わりません。システム的に1スレッドしか無いことがわかります。
Corei9 3.6GHz VirtualBox 上での試験
試しにiMac2020 のCorei9モデル(3.6GHz)にVirtualBoxを立ててその上でも実施します。アサインしているコア数は4です。
$ sysbench --test=cpu --threads=1 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 1
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 1478.45
General statistics:
total time: 10.0007s
total number of events: 14787
Latency (ms):
min: 0.63
avg: 0.68
max: 6.16
95th percentile: 0.80
sum: 9994.56
Threads fairness:
events (avg/stddev): 14787.0000/0.00
execution time (avg/stddev): 9.9946/0.00
$ sysbench --test=cpu --threads=4 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 4
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 5806.52
General statistics:
total time: 10.0012s
total number of events: 58080
Latency (ms):
min: 0.64
avg: 0.69
max: 23.70
95th percentile: 0.86
sum: 39985.03
Threads fairness:
events (avg/stddev): 14520.0000/75.67
execution time (avg/stddev): 9.9963/0.00
$ sysbench --test=cpu --threads=8 run
WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
sysbench 1.0.18 (using system LuaJIT 2.1.0-beta3)
Running the test with following options:
Number of threads: 8
Initializing random number generator from current time
Prime numbers limit: 10000
Initializing worker threads...
Threads started!
CPU speed:
events per second: 5906.27
General statistics:
total time: 10.0018s
total number of events: 59079
Latency (ms):
min: 0.64
avg: 1.35
max: 33.16
95th percentile: 8.90
sum: 79921.31
Threads fairness:
events (avg/stddev): 7384.8750/82.71
execution time (avg/stddev): 9.9902/0.01
シングルスレッドで2倍近くはやい、4スレッドで6000近いです。やはりシングルスレッド性能が高いとサクサク感が違います。やはりAWSでも月10ドルだとこんなものか。