2

In the Clojure world, the main web framework Compojure turned out not to be good for heavyweight ajax and long-running polls because it used a thread per request. (Not blaming the brilliant guys who put it together, it solved the right problem at the time.) So they ended up building Pedestal.

I'm keen to avoid this same issue when selecting a Scala Web Framework.

So assuming I have an Ajax heavy web application with SSE and Websockets and other messaging going on. Assuming (as a hypothetical example) this is a multi-player poker application with chat and social notifications.

My question is - out of the major Scala Frameworks (Lift, Play 2, Scalatra, Pinky, Sweet), which ones don't use one thread per request?

Assumptions:

  • by this I mean do not block threads while listening for incoming requests
Community
  • 1
  • 1
hawkeye
  • 34,745
  • 30
  • 150
  • 304
  • 2
    Play and Scalatra do not. Play even has special support for websockets. Not sure about the other ones, I've never used them. – vptheron Jun 26 '14 at 23:07
  • So... on the JVM, how could you handle a request without a thread? Do you mean such that there is some abstraction (such as actors) over the threads? Perhaps I'm misunderstanding what you are asking for exactly. Also, what technologies might you use on the client? – joescii Jun 26 '14 at 23:47
  • @joescii Imagine you make a database query while serving the request. You need to wait for the query result to answer the request. Do you take up a thread (doing nothing) while waiting? – Daniel Darabos Jun 27 '14 at 00:17
  • @DanielDarabos I see. But isn't that more of a problem with the DB technology/API you are using, and not the web framework? For instance, I don't care what web framework you use to call a SQL DB thru JDBC (Slick or whatever). That thread is gonna block. – joescii Jun 27 '14 at 00:29
  • 1
    @joescii There are always akka technologies for your use. It support actor system like erlang – ayvango Jun 27 '14 at 10:25
  • @ayvango Agreed, but the underlying thread used by akka will still block when making that blocking call. I assume perhaps the OP intends to ask which of these frameworks do not block threads while listening for incoming requests? AFAIK, that's the only block/non-block concern with web frameworks. – joescii Jun 30 '14 at 14:56

0 Answers0