[systemd-devel] Early review request: socket activation bridge

David Strauss david at davidstrauss.net
Tue Oct 8 02:07:27 PDT 2013


I've attached the initial implementation -- not yet ready to merge --
for an event-oriented socket activation bridge. It performs well under
load. I haven't tied up all potential leaks yet, but the normal
execution paths seem to be clean. I also need to use proper shell
option management.

The bridge adds about 0.569ms to an average request, which is the same
overhead I see from a normal, local-network Ethernet hop.

This is with it wrapping nginx using Fedora's default nginx
configuration and default homepage:

[straussd at olympian straussd]# ab -n1000 -c10 http://localhost:8080/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
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)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        nginx/1.4.2
Server Hostname:        localhost
Server Port:            8080

Document Path:          /
Document Length:        3700 bytes

Concurrency Level:      10
Time taken for tests:   0.192 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3933000 bytes
HTML transferred:       3700000 bytes
Requests per second:    5214.39 [#/sec] (mean)
Time per request:       1.918 [ms] (mean)
Time per request:       0.192 [ms] (mean, across all concurrent requests)
Transfer rate:          20027.53 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       2
Processing:     0    2   0.4      2       4
Waiting:        0    1   0.3      1       3
Total:          1    2   0.4      2       4

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

For comparison, here is direct nginx over TCP:

[straussd at olympian straussd]# ab -n1000 -c10 http://localhost:80/
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
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)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        nginx/1.4.2
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        3700 bytes

Concurrency Level:      10
Time taken for tests:   0.135 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3933000 bytes
HTML transferred:       3700000 bytes
Requests per second:    7411.52 [#/sec] (mean)
Time per request:       1.349 [ms] (mean)
Time per request:       0.135 [ms] (mean, across all concurrent requests)
Transfer rate:          28466.34 [Kbytes/sec] received

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

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      2
  95%      2
  98%      2
  99%      2
 100%      3 (longest request)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sabridge.c
Type: text/x-csrc
Size: 9090 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131008/bce12097/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx.service
Type: application/octet-stream
Size: 297 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131008/bce12097/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx.socket
Type: application/octet-stream
Size: 26 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131008/bce12097/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sabridge.sh
Type: application/x-sh
Size: 170 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20131008/bce12097/attachment-0001.sh>


More information about the systemd-devel mailing list