Haskell for webservice? Real-Time!
Yesterday, a friend started a war about a programming language for Real-Time API. He did a little mistake because I’m always… I remember the very long war about Emacs vs Vim (Vim wins).
The subject was about RT (Real-Time) web service/microservice.
What’s RT?
We consider RT a latency less than or equal to 30ms.
I let you imagine 2 microservices:
- service 1 sent a request to service 2
- service 2 received the request from service 1: process and send the reply
- service 1 received the reply from service 2
The time between point 1 and point 3 ≤ 30ms
Tools used for this quick RT webservice
To test and obtain the graph, I used rtapi (from Nginx)
Nothing more… KISS > all
Code and online test
- code: https://github.com/sycured/streaming-calc-haskell-yesod
- container ready to use: ghcr.io/sycured/schy:latest
- test server: https://schy.sycured.com
Will I use Haskell for a real-world app?
I love Haskell because we don’t have side effects.
Performance + no side effect = 💓
Read more about NodeJS vs Haskell
- https://gist.github.com/paf31/9c4d402d400d61a49656
- https://www.fpcomplete.com/blog/2016/12/concurrency-and-node