HTTP requests bench

Plain HTTP access to a Pharo image can be quite fast. Here is quick & dirty benchmark I just did on one of our modern/big machines (inside an LXD container, light load) using a single stock image on Linux.

$ pharo Pharo.image printVersion
[version] 4.0 #40626

$ pharo Pharo.image eval ‘ZnServer startDefaultOn: 1701. 1 hour wait’ &

$ ab -k -c 8 -n 10240 http://127.0.0.1:1701/bytes/32
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1024 requests
Completed 2048 requests
Completed 3072 requests
Completed 4096 requests
Completed 5120 requests
Completed 6144 requests
Completed 7168 requests
Completed 8192 requests
Completed 9216 requests
Completed 10240 requests
Finished 10240 requests

Server Software: Zinc
Server Hostname: 127.0.0.1
Server Port: 1701

Document Path: /bytes/32
Document Length: 32 bytes

Concurrency Level: 8
Time taken for tests: 1.945 seconds
Complete requests: 10240
Failed requests: 0
Keep-Alive requests: 10240
Total transferred: 2109440 bytes
HTML transferred: 327680 bytes
Requests per second: 5265.17 [#/sec] (mean)
Time per request: 1.519 [ms] (mean)
Time per request: 0.190 [ms] (mean, across all concurrent requests)
Transfer rate: 1059.20 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 2
Processing: 0 2 8.0 2 309
Waiting: 0 1 8.0 1 309
Total: 0 2 8.0 2 309

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

More than 5K req/s (10K requests, 8 concurrent clients).

Granted, this is only for just 32 bytes payload and the loopback network interface. But this is the other end of the interval, the maximum speed.

A more realistic payload (7K HTML) gives the following:

$ ab -k -c 8 -n 10240 http://127.0.0.1:1701/dw-bench
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 1024 requests
Completed 2048 requests
Completed 3072 requests
Completed 4096 requests
Completed 5120 requests
Completed 6144 requests
Completed 7168 requests
Completed 8192 requests
Completed 9216 requests
Completed 10240 requests
Finished 10240 requests

Server Software: Zinc
Server Hostname: 127.0.0.1
Server Port: 1701

Document Path: /dw-bench
Document Length: 7734 bytes

Concurrency Level: 8
Time taken for tests: 7.874 seconds
Complete requests: 10240
Failed requests: 0
Keep-Alive requests: 10240
Total transferred: 80988160 bytes
HTML transferred: 79196160 bytes
Requests per second: 1300.46 [#/sec] (mean)
Time per request: 6.152 [ms] (mean)
Time per request: 0.769 [ms] (mean, across all concurrent requests)
Transfer rate: 10044.25 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 1 6 183.4 1 7874
Waiting: 1 6 183.4 1 7874
Total: 1 6 183.4 1 7874

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 7874 (longest request)

That is more than 1K req/s.

In both cases we are talking about sub 1ms req/resp cycles !

I think all commercial users of Pharo today know what is possible and what needs to be done to achieve their goals. Pure speed might not be the main consideration, ease/speed/joy of development and just being capable of solving complex problems and offering compelling solutions to end users is probably more important.

Sven

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: