Raw sockets benchmarks

Introduction
Squeak
Gemstone
VisualWorks
Code - Squeak
Code - VisualWorks

Introduction

To measure performance of sockets on various Smalltalks and try to optimize them.

Benchmarking was done on P4 3.20GHz with 2GB memory running SuSE Linux 10.0 64bit, on VisualWorks 7.6, Squeak 3.9 and Gemstone64 2.2.5 Web edition.

Squeak

  • 120B (header only) response, every connection is immediately closed
  • 2000 req/s 350 KBytes/s
  • httperf --server localhost --port 9999 --uri "/" --rate 2000 --num-conn 2000
  • 3K response, every connection is immediately closed
  • 1000 req/s, 3MBytes/s (24Mbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 1000 --num-conn1000
  • 100K response, every connection is immediately closed
  • 800 req/s, 80MBytes/s (640Mbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 800 --num-conn 800
  • 1M response, every connection is immediately closed
  • 180 req/s, 180MBytes/s (1.4Gbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 180 --num-conn 180

Gemstone

VisualWorks

  • 120B (header only) response, every connection is immediately closed
  • 2000 req/s, 350KBytes/s (3Mbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 2000 --num-conn 2000
  • 3K response, every connection is immediately closed
  • 1700 req/s, 5 MBytes/s (40Mbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 2000 --num-conn 9000
  • 100K response, every connection is immediately closed
  • 900 req/s, 88MBytes/s (0.7Gbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 900 --num-conn 900
  • 1M response, every connection is immediately closed
  • 210 req/, 200MBytes/s (1.7Gbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 210 --num-conn 210
  • 10M response, every connection is immediately closed
  • 40 req/s 370MBytes/s (3Gbits/s)
  • httperf --server localhost --port 9999 --uri "/" --rate 40 --num-conn 40

Code - Squeak

serverLoop
    | socket clientSocket |
    socket := SpSocket newTCPSocket.
    socket
        setAddressReuse: true;
        bindSocketAddress: (SpIPAddress hostName: 'localhost' port: 9999).
    [    socket listenBackloggingUpTo: 50.
        [true] whileTrue: 
            [     clientSocket := socket accept.
                [ [true] whileTrue: 
                    [clientSocket underlyingSocket waitForData.
                    clientSocket read: 60. "HTTP request"
                    clientSocket write: self content] ]
                on: Error "probably connection close by peer"
                do: [:ex | "nothing"]
            ]
    ] ensure: [clientSocket notNil ifTrue: [clientSocket close]. socket close]

Code - VisualWorks

serverLoop
| socket clientSocket |
socket := SpSocket newTCPSocket.
socket
setAddressReuse: true;
bindSocketAddress: (SpIPAddress hostName: 'localhost' port: 9999).
[ socket listenBackloggingUpTo: 50.
[true] whileTrue:
[ clientSocket := socket accept.
[ [true] whileTrue:
[clientSocket read: 60. "HTTP request"
clientSocket write: self content] ]
on: Error "probably connection close by peer"
do: [:ex | "nothing"]
]
] ensure: [clientSocket notNil ifTrue: [clientSocket close]. socket close]
 




Updated: 9.5.2008