Racket web-server operating in asynchronous mode (event based)
Asked Answered
B

1

6

I am planning to develop REST based services using Racket and its web-server. One requirement that I have is the web-server operating in asynchronous mode (non-blocking event-based).

Is there an example to configure or customize the Racket web-server to operate in asynchronous mode ?

I have browsed through the Racket documentation but cannot figure out how to do this.

Bunns answered 9/9, 2013 at 16:15 Comment(2)
Is your requirement really for a specific implementation like non-blocking event-based? Or is it a performance requirement like X requests per second? I ask because AFAIK the supplied racket/web-server uses Racket threads (which are lightweight "green threads", not OS threads). You could try it, see if it meets your performance reqs. (Having said that, Racket's does allow non-blocking I/O, so I suppose you could roll your own REST server if you believe that implementation is the primary consideration.)Testa
At the moment, this requirement is a "spec" feature. I will test out the Racket web-server to see how many requests it can handle per second and compare that to Scala + Play Framework.Bunns
E
8

I am the author of the Racket Web server. It is always in asynchronous mode. As Greg mentions, it uses Racket threads, which compile to continuations and when you do blocking IO operations, those are stored in a data structure associated with the blocked port, which is polled using kpoll/kqueue/etc, just like manually-written asynchronous IO servers.

Education answered 9/12, 2015 at 12:31 Comment(3)
After all these years, Can the same thing be said for the Racket WebSockets Server as well? Does Racket WebSockets Server work in asynchronous mode?Faldstool
Yes, it works the same way.Education
Great! Thanks for the great software and the answer. I will be looking for switching to Racket for general personal projects wherever possible. Even for https and websockets apps.Faldstool

© 2022 - 2024 — McMap. All rights reserved.