[Haskell-cafe] Efficient memory use for tens of thousands of connections

Ben Bangert ben at groovie.org
Fri May 8 00:12:42 UTC 2015


I'm currently evaluating memory overhead for a variety of simple Websocket
based echo server to get a gauge of minimal memory penalty per connection
along with SSL overhead per connection.

I've created two websocket servers in Haskell:
https://github.com/bbangert/ssl-ram-testing/tree/master/Haskell

One using Yesod + jaspers Websockets lib, the other with Yesod + Mishael
Snoyman's native websocket lib. I was curious what options I might be
missing that would ensure a more efficient use of memory, at the moment the
non-SSL seems to use about 48kb per connection, while using Haskell's TLS
via warp-tls introduces a huge amount of overhead (along with odd handshake
issues).

Here's what my results look like:
No SSL
Program started.
Tester started.
Tester finished connecting.
Waiting: 360  Last Memory Increase: 2
WARNING: Program hasn't stopped increasing.
Started with: 2633728
Ended with: 50896896
kB per connection: 47.13


SSL
Program started.
Tester started.
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
yesod-customws-tls: HandshakeFailed (Error_Protocol ("bad record
mac",True,BadRecordMac))
WARNING: Failed to connect all clients
Tester finished connecting.
Waiting: 360  Last Memory Increase: 4
WARNING: Program hasn't stopped increasing.
Started with: 3170304
Ended with: 454221824
kB per connection: 444.03

SSL Overhead per Conn: 396.90

I wait up to 6 minutes for memory to level out, it never does with or
without SSL. Is this expected behavior? If not, what options am I missing?

The ssl-ram-testing repo includes full directions on how to reproduce this
and run this test.

Cheers,
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150507/06179537/attachment.html>


More information about the Haskell-Cafe mailing list