Benchmark Micro-Framework

Bagaimana benchmark dilakukan?

Benchmark “Hello World” telah ditunjukan untuk mengidentifikasi beban load terkecil dari tiap framework. Kali ini Benchmark Micro-Framework akan dilakukan dgn cara yg serupa.

Benchmark kali ini menggunakan  sebuah route untuk perintah HTTP ‘GET’ yg diberi parameter kemudian mengembalikan respon berupa “Hello $name”.

Pengukuran apa saja yg dicatat?

Ini adalah daftar aspek yg diukur untuk mengidentifikasi keseluruhan performa dari tiap framework:

  • Requests per second
  • Waktu operasi (rerata) pada concurrent requests
  • Jumlah file includepada tiap request (diukur dgn fungsi get_included_files)
  • Penggunaan Memory per request (diukur dgn fungsi memory_get_usage)

Framework yg diuji

Hasil

Slim Framework

# ab -n 1000 -c 5 http://localhost/bench/micro/slim/say/hello/Sonny;
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:        Apache/2.2.22
Server Hostname:        localhost
Server Port:            80

Document Path:          /bench/micro/slim/say/hello/Sonny
Document Length:        13 bytes

Concurrency Level:      5
Time taken for tests:   0.882 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      206000 bytes
HTML transferred:       13000 bytes
Requests per second:    1134.21 [#/sec] (mean)
Time per request:       4.408 [ms] (mean)
Time per request:       0.882 [ms] (mean, across all concurrent requests)
Transfer rate:          228.17 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4   2.4      4      33
Processing:     0    0   0.5      0      11
Waiting:        0    0   0.5      0      11
Total:          2    4   2.4      4      33

Percentage of the requests served within a certain time (ms)
  50%      4
  66%      4
  75%      5
  80%      5
  90%      6
  95%      8
  98%     12
  99%     14
 100%     33 (longest request)

Silex

# ab -n 1000 -c 5 http://localhost/bench/micro/silex/say/hello/Sonny;
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:        Apache/2.2.22
Server Hostname:        localhost
Server Port:            80

Document Path:          /bench/micro/silex/say/hello/Sonny
Document Length:        12 bytes

Concurrency Level:      5
Time taken for tests:   2.228 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      225000 bytes
HTML transferred:       12000 bytes
Requests per second:    448.75 [#/sec] (mean)
Time per request:       11.142 [ms] (mean)
Time per request:       2.228 [ms] (mean, across all concurrent requests)
Transfer rate:          98.60 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   11   5.1     10      44
Processing:     0    0   1.1      0      26
Waiting:        0    0   1.1      0      26
Total:          5   11   5.1     10      45

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     12
  75%     13
  80%     14
  90%     17
  95%     20
  98%     25
  99%     29
 100%     45 (longest request)

Phalcon 0.5.0

# ab -n 1000 -c 5 http://localhost/bench/micro/phalcon/say/hello/Sonny;
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software:        Apache/2.2.22
Server Hostname:        localhost
Server Port:            80

Document Path:          /bench/micro/phalcon/say/hello/Sonny
Document Length:        12 bytes

Concurrency Level:      5
Time taken for tests:   0.397 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      205000 bytes
HTML transferred:       12000 bytes
Requests per second:    2516.74 [#/sec] (mean)
Time per request:       1.987 [ms] (mean)
Time per request:       0.397 [ms] (mean, across all concurrent requests)
Transfer rate:          503.84 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   0.9      2      11
Processing:     0    0   0.2      0       5
Waiting:        0    0   0.2      0       4
Total:          1    2   0.9      2      11

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      2
  90%      3
  95%      4
  98%      5
  99%      5
 100%     11 (longest request)

Graphs

The first graph shows how many requests per second each framework was able to accept. The second shows the average time across all concurrent requests.

Framework / Requests per second (#/sec)
[more is better]

Micro - Request per Second

Micro – Request per Second

Framework / Time per Request (mean, across all concurrent requests)
[less is better]

Micro - Time per Request

Micro – Time per Request

Framework / Number of included PHP files (mean, number on a singlerequest)
[less is better]

Micro - Include File

Micro – Include File

Framework / Memory Usage (mean, megabytes per request)
[less isbetter]

Micro - Memory Usage

Micro – Memory Usage

Kesimpulan

Sifat alamiah dari Phalcon yg compiled menawarkan performa luarbiasa yg jauh melebihi semua framework lainnya yg mengikuti benchmark ini.

Terjemah dari Benchmark Micro-Framework http://docs.phalconphp.com/en/latest/reference/benchmark/micro.html