> All that pretty much means that currently Nim is not ready to be used for 
> simple, reliable and performant servers.

Are you aware of 
[GuildenStern](https://github.com/olliNiinivaara/GuildenStern), the Modular 
multithreading Linux HTTP server written in Nim? I think it's a proof that Nim 
**is** ready for simple, reliable and performant servers. Of course 
GuildenStern might not be ready for every use case, but that is not a problem 
of Nim - many Nim open source projects just lack an arsenal of contributors.

[This 
bench](https://github.com/olliNiinivaara/GuildenStern/blob/master/bench/results.txt)
 shows (run with only 4 cores) that spawning is faster than "asynccing" when 
generating responses requires some work.

Here's how your experiment would be written with GuildenStern:
    
    
    import os, guildenstern/ctxheader
    
    proc process(ctx: HttpCtx) =
      sleep 100
      var response = "processed something"
      ctx.reply(response)
    
    var server = new GuildenServer
    server.initHeaderCtx(process, 5000)
    server.serve()
    
    
    Run

and results in: 
    
    
    olli@nexus:~/Nim/Testit/guildenstern$ wrk -t2 -c2 -d10s 
http://localhost:5000
    Running 10s test @ http://localhost:5000
      2 threads and 2 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency   100.59ms   77.12us 100.83ms   71.72%
        Req/Sec     9.95      0.50    10.00     98.99%
      198 requests in 10.02s, 11.21KB read
    Requests/sec:     19.76
    Transfer/sec:      1.12KB
    
    
    Run

Reply via email to