うえださんが通りますよ

ServersMan@VPS と さくらVPS ベンチマーク比較

まずはServersMan@VPS の1Gプラン。OSはDebian。

ベンチマークスコアはこちらの当時2013年の計測結果より低い428.5。

こちらの2013年当時のスコアより低い…

VPS比較2017年版:ベンチマーク:お名前/さくら/Conoha/GMO/カゴヤ/Serversman/Vultr/WebArena/Digital Ocean

同じサーバーを使いまわしているのか、リソース制限を行っているのかわからないけれど 、作業用だったりする分にはさほど困らない。

========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)

System: localhost.localdomain: GNU/Linux
OS: GNU/Linux -- 2.6.32-042stab092.2 -- #1 SMP Tue Jul 8 10:35:55 MSK 2014
Machine: x86_64 (unknown)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4522.3 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
CPU 1: Intel(R) Xeon(R) CPU L5520 @ 2.27GHz (4521.3 bogomips)
Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
11:52:36 up 31 min,  1 user,  load average: 0.12, 0.06, 0.05; runlevel 2017-10-27

------------------------------------------------------------------------
Benchmark Run: Fri Oct 27 2017 11:52:36 - 12:20:34
2 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       10158377.7 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     1230.8 MWIPS (9.9 s, 7 samples)
Execl Throughput                               1370.4 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        201124.7 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           58692.4 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        407322.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                              568325.6 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  85595.3 lps   (10.0 s, 7 samples)
Process Creation                               3629.8 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   1849.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    243.3 lpm   (60.1 s, 2 samples)
System Call Overhead                        1266654.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   10158377.7    870.5
Double-Precision Whetstone                       55.0       1230.8    223.8
Execl Throughput                                 43.0       1370.4    318.7
File Copy 1024 bufsize 2000 maxblocks          3960.0     201124.7    507.9
File Copy 256 bufsize 500 maxblocks            1655.0      58692.4    354.6
File Copy 4096 bufsize 8000 maxblocks          5800.0     407322.6    702.3
Pipe Throughput                               12440.0     568325.6    456.9
Pipe-based Context Switching                   4000.0      85595.3    214.0
Process Creation                                126.0       3629.8    288.1
Shell Scripts (1 concurrent)                     42.4       1849.6    436.2
Shell Scripts (8 concurrent)                      6.0        243.3    405.5
System Call Overhead                          15000.0    1266654.8    844.4
========
System Benchmarks Index Score                                         423.2

------------------------------------------------------------------------
Benchmark Run: Fri Oct 27 2017 12:20:34 - 12:48:50
2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables        9753272.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     1221.4 MWIPS (9.8 s, 7 samples)
Execl Throughput                               1339.2 lps   (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        212298.5 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks           60007.8 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks        419473.5 KBps  (30.0 s, 2 samples)
Pipe Throughput                              545486.5 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  81212.5 lps   (10.0 s, 7 samples)
Process Creation                               4004.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2000.9 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                    258.4 lpm   (60.1 s, 2 samples)
System Call Overhead                        1231140.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0    9753272.5    835.8
Double-Precision Whetstone                       55.0       1221.4    222.1
Execl Throughput                                 43.0       1339.2    311.4
File Copy 1024 bufsize 2000 maxblocks          3960.0     212298.5    536.1
File Copy 256 bufsize 500 maxblocks            1655.0      60007.8    362.6
File Copy 4096 bufsize 8000 maxblocks          5800.0     419473.5    723.2
Pipe Throughput                               12440.0     545486.5    438.5
Pipe-based Context Switching                   4000.0      81212.5    203.0
Process Creation                                126.0       4004.2    317.8
Shell Scripts (1 concurrent)                     42.4       2000.9    471.9
Shell Scripts (8 concurrent)                      6.0        258.4    430.6
System Call Overhead                          15000.0    1231140.8    820.8
========
System Benchmarks Index Score                                         428.5

つづいてさくらVPSの1GSSDプラン。。ベンチマークスコアだけ見ると2738.6とServersManの6.3倍ほど。

シングルコアでも1387.3。

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: tk2-262-40721: GNU/Linux
   OS: GNU/Linux -- 4.9.0-3-amd64 -- #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26)
   Machine: x86_64 (unknown)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz (5200.0 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   CPU 1: Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz (5200.0 bogomips)
          x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   15:20:48 up 1 day, 21:32,  3 users,  load average: 0.05, 0.02, 0.00; runlevel 2017-11-06

------------------------------------------------------------------------
Benchmark Run: Wed Nov 08 2017 15:20:48 - 15:48:51
2 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       32952931.5 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     4417.2 MWIPS (10.0 s, 7 samples)
Execl Throughput                               3365.5 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1069512.3 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          296864.7 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2149466.4 KBps  (30.0 s, 2 samples)
Pipe Throughput                             2129086.3 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  36607.1 lps   (10.0 s, 7 samples)
Process Creation                               7170.1 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  10029.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   2099.1 lpm   (60.0 s, 2 samples)
System Call Overhead                        3243491.4 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   32952931.5   2823.7
Double-Precision Whetstone                       55.0       4417.2    803.1
Execl Throughput                                 43.0       3365.5    782.7
File Copy 1024 bufsize 2000 maxblocks          3960.0    1069512.3   2700.8
File Copy 256 bufsize 500 maxblocks            1655.0     296864.7   1793.7
File Copy 4096 bufsize 8000 maxblocks          5800.0    2149466.4   3706.0
Pipe Throughput                               12440.0    2129086.3   1711.5
Pipe-based Context Switching                   4000.0      36607.1     91.5
Process Creation                                126.0       7170.1    569.1
Shell Scripts (1 concurrent)                     42.4      10029.6   2365.5
Shell Scripts (8 concurrent)                      6.0       2099.1   3498.6
System Call Overhead                          15000.0    3243491.4   2162.3
                                                                   ========
System Benchmarks Index Score                                        1387.3

------------------------------------------------------------------------
Benchmark Run: Wed Nov 08 2017 15:48:51 - 16:16:55
2 CPUs in system; running 2 parallel copies of tests

Dhrystone 2 using register variables       67343928.9 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     8910.0 MWIPS (9.9 s, 7 samples)
Execl Throughput                               8652.9 lps   (29.8 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1206713.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          312272.9 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       3232206.8 KBps  (30.0 s, 2 samples)
Pipe Throughput                             4284960.3 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 582826.1 lps   (10.0 s, 7 samples)
Process Creation                              18877.1 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                  15325.6 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   2176.4 lpm   (60.0 s, 2 samples)
System Call Overhead                        4493017.0 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   67343928.9   5770.7
Double-Precision Whetstone                       55.0       8910.0   1620.0
Execl Throughput                                 43.0       8652.9   2012.3
File Copy 1024 bufsize 2000 maxblocks          3960.0    1206713.4   3047.3
File Copy 256 bufsize 500 maxblocks            1655.0     312272.9   1886.8
File Copy 4096 bufsize 8000 maxblocks          5800.0    3232206.8   5572.8
Pipe Throughput                               12440.0    4284960.3   3444.5
Pipe-based Context Switching                   4000.0     582826.1   1457.1
Process Creation                                126.0      18877.1   1498.2
Shell Scripts (1 concurrent)                     42.4      15325.6   3614.5
Shell Scripts (8 concurrent)                      6.0       2176.4   3627.4
System Call Overhead                          15000.0    4493017.0   2995.3
                                                                   ========
System Benchmarks Index Score                                        2738.6

プライベート用はServersMan、公開用はさくら、とかで使い分けるのがいいかも。

Debianサーバーで文字化け

日本語が化ける。

user@localhost:~$ locale
LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

POSIXて。。

export LANG=ja_JP.UTF-8

なおった。

.bashrcに追記してめでたしめでたし

特定の文字列を含まないファイル一覧を取得する

hogeとファイル中に記載されていないファイル一覧を取得したい。

ワンライナーで書けたのでメモ。

find . -name "*.html" -print0 | xargs -0 perl -nle '/hoge/ and close(ARGV) and next; print "$ARGV" if eof(ARGV);'

findでファイルを読み込む。 perlclose(ARGV)は現在読み込み中のファイルをクローズする操作で、ただ、クローズ直後はファイルポインタがEOFになっただけなので、nextしてループを次にすることで、次のファイルを読み込みに相当させる。Perlではループ終了のための構文はbreakではなくてlastだが、上記でnextじゃなくてlastを記述すると、プログラム自体が終了してしまう。

雑な解説。