Racket matching or exceeding Golang for Echo server performance

Hey. It's hard to find many performance comparisons outside of the benchmarks team game, so I thought this might be an interesting data point.

I was stumbling around, writing a TCP-based echo server, only later coming across the "Systems programming with racket" ( More: Systems Programming with Racket ) article.

I ended up with a TCP-based server, spawning a (racket) thread) for each new client, using break-thread to terminate threads and custodians to manage resource cleanup.
(program: https://gist.github.com/jwdevantier/ed6aae4288bd9049034fcf95063e51bf )

To ascertain performance, I wrote a program to stress-test the server in golang, spawning several client threads to send messages while keeping track of how many was sent.
(program: https://github.com/jwdevantier/daemonload/blob/master/cmd/spammer/spammer.go )

I then modified a very simple echo-server in golang to have something to test against
(program: https://github.com/jwdevantier/daemonload/blob/master/cmd/echosrv/echosrv.go )

Finally I benchmarked it all with the load test using 3 threads simulating 3 clients which send messages as fast as they can for 180 seconds.

Racket server: ~114,584 messages/sec
The Go server (default): ~85,650 messages/sec
Go server (GOMAXPROCS=1): ~108,495 messages/sec
(full results: https://gist.github.com/jwdevantier/469fcb6d0d150d632dd656d53a9b7355 )

When instructing Go to not use as many OS threads (default is 1 per CPU thread), it almost caught up, but remains behind the racket server for each test.


This, of course, does not tell us much aside from Racket doing well for echo servers, but it definitely shows that Racket is no slouch in this case :slight_smile:

12 Likes

Thank you for sharing. It is gratifying to see the work by all the contributors pay off.

2 Likes