Forgot to clarify, I setup both projects with cabal using GHC 7.10 with Stackage nightly from 5/6/15 (per the README's), running under Ubuntu 14.04.

On Thu, May 7, 2015 at 5:12 PM, Ben Bangert <ben@groovie.org> wrote:
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