Skip to content

Instantly share code, notes, and snippets.

@matsumotory
Last active August 29, 2015 13:57
Show Gist options
  • Save matsumotory/9702123 to your computer and use it in GitHub Desktop.
Save matsumotory/9702123 to your computer and use it in GitHub Desktop.
mruby-http2 no-tls benchmark. GitHub: https://github.com/matsumoto-r/mruby-http2
(Fedora19 on VMWare)
$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
stepping : 3
microcode : 0x9
cpu MHz : 3498.029
cache size : 8192 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm fsgsbase smep
bogomips : 6996.05
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
stepping : 3
microcode : 0x9
cpu MHz : 3498.029
cache size : 8192 KB
physical id : 2
siblings : 1
core id : 0
cpu cores : 1
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm fsgsbase smep
bogomips : 6996.05
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
$ free -m
total used free shared buffers cached
Mem: 7979 1063 6915 0 214 543
-/+ buffers/cache: 305 7673
Swap: 2079 0 2079
$ h2load -n1000000 -c100 -m100 http://127.0.0.1:8080/index.html
starting benchmark...
spawning thread #0: 100 concurrent clients, 1000000 total requests
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done
finished in 2 sec, 970 millisec and 170 microsec, 336681 req/s, 8220 kbytes/s
requests: 1000000 total, 1000000 started, 1000000 done, 1000000 succeeded, 0 failed, 0 errored
status codes: 1000000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 49003700 bytes total, 1600 bytes headers, 25000000 bytes data
root_dir = "/usr/local/trusterd"
s = HTTP2::Server.new({
:port => 8080,
:key => "#{root_dir}/ssl/server.key",
:crt => "#{root_dir}/ssl/server.crt",
:document_root => "#{root_dir}/htdocs",
:server_name => "mruby-http2 server",
# optional default
# :debug => false
# :tls => true
# :daemon => false,
:tls => false,
})
s.run
# ./bin/mruby http2_server.rb
hello mruby-http2 world.
$ nghttp -v http://127.0.0.1:8080/index.html
[ 0.001] send SETTINGS frame <length=10, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[ 0.001] send HEADERS frame <length=48, flags=0x05, stream_id=1>
; END_STREAM | END_HEADERS
(padlen=0)
; Open new stream
:authority: 127.0.0.1:8080
:method: GET
:path: /index.html
:scheme: http
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/0.4.0-DEV
[ 0.002] recv SETTINGS frame <length=5, flags=0x00, stream_id=0>
(niv=1)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[ 0.002] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.003] (stream_id=1) :status: 200
[ 0.003] (stream_id=1) server: mruby-http2 server
[ 0.003] recv HEADERS frame <length=16, flags=0x04, stream_id=1>
; END_HEADERS
(padlen=0)
; First response header
hello mruby-http2 world.
[ 0.003] recv DATA frame <length=25, flags=0x00, stream_id=1>
[ 0.003] recv DATA frame <length=0, flags=0x01, stream_id=1>
; END_STREAM
[ 0.003] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.003] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])
@matsumotory
Copy link
Author

ありがとうございます!nginxとか比較対象(厳密にはプロトコルが違うので比較にならないが)があると目安になってわかりやすそうですね。

@matsumotory
Copy link
Author

誘導... matsumotory/mruby-http2#1

日本語でもOKです。ここだと通知とか無くて気付けなさそうですし。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment