Li Haoyi
Li Haoyi

Reputation: 15802

Scala/Lift: Does it require special http routing?

Since Lift is stateful, each subsequent request to a page/site must go back to the same server. Presumably that means that the front-end load balancer needs to keep track of which client is talking to which server.

How does that work out for hosting on places like Heroku/Elastic Beanstalk, where the load balancer is all done automagically for you by the service? I know if you are setting up all your machines yourself you can set the routing to do the correct thing, but how does it work on these PaaS type hosts where all this is meant to be done for you?

EDIT: Google App Engine would have the same limitations, if i am not mistaken?

Upvotes: 3

Views: 339

Answers (2)

timothy
timothy

Reputation: 497

Lift is not really intended to be used in a pure stateless mode, its possible, but its not where the framework excels. ELB does indeed have support for sticky sessions, which is the configuration you need to take up in order to use Lift successfully in nearly any environment.

More broadly, this "sticky session" functionality can be achieved with either software of L4 hardware balancing. You might be interested in chapter 15 of Lift in Action which spends a fair amount of time discussing this very subject and the various session serialisation strategies if you really want that.

Upvotes: 2

seadowg
seadowg

Reputation: 4265

Heroku will distribute requests between dynos (processes) evenly so I believe you would have to use some form of sessions serialisation for a stateful Lift app. I believe Elastic Beanstalk does have some facilities to support this however (as ELB does).

David Pollock writes about how to use Lift in a stateless way and also talks generally about the design of Lift in this area here.

Upvotes: 4

Related Questions