What actor-based web frameworks are available for Scala?

I need to create a very parallel web service that will provide a REST-based API for JavaScript (front end) and Rails (back end). The web service will match the data access API in MongoDB.

I already wrote an initial implementation using NodeJS and would like to try a Scala based solution. I also consider Erlang, for which each web infrastructure is actor based.

So, I am looking for an explicit assembly of web frameworks using Actors to support massive loading of queries, which I am very new to Scala, and I don’t quite understand how Actor can work if almost all Scala frameworks are based on Java servlets that create a thread for every request that just runs out of resources in my script.

+7
scala frameworks actor
source share
4 answers
  • If you really have 10k + long active connections at a time, then any standard server / infrastructure of Java applications (maybe except Netty) will not work for you - they all consume a lot of memory (even if some kind of smart NIO is used). You are better off sticking to a cluster solution based on an event loop (e.g. node.js that you have already tried), mongrel with zeroMQ support, nginx with MQ write mode polled by Scala Actors, etc.

  • Among the Scala / Java frameworks, Lift has good async support for REST (although it is not directly tied to actors). OTOH, LinkedIn uses Scalatra + stdlib actors for its REST services for Signal and feels great.

+3
source share

Another option is the Play framework . The latest version 1.1 supports Scala. It also supports akka as a module.

+1
source share

As for Scala, they are working on a new request, an abstraction called SSGI (akin to the Servlet / Rack / WSGI / WAI layer), which, they said, should allow them to fail only as a Servlet, and also work on something that was built with netty. See here here . http://github.com/scalatra/ssgi

There are some more interesting frameworks at the Scalatra simplicity level, designed from scratch to support asynchronous web services (do not bind the stream to the request):

https://github.com/jdegoes/blueeyes - not a servlet; built on netty. ("weakly inspired ... Scalatra")

http://spray.cc/ - Built on chords Akka Akka Mist. Continuation of servlet 3.0 or Jetty ("the spray was strongly inspired by BlueEyes and Scalatra.")

And at a lower level: https://github.com/rschildmeijer/loft - "Non-blocking, asynchronous, single-threaded network based on server continuity." Not ready for production, but quite an interesting look. A compiler plugin is required to continue.

+1
source share

http://liftweb.net/ Indeed, the request starts as a servlet, but then the lift uses the comet support found in many servlet containers to tear itself away from the stream, preserving the request context (which the container then does not destroy), which can then be used for output data from the participants.

http://akkasource.org also has support for relaxation, but it blocks the flow until the actor finishes his work.

0
source share

All Articles