Scala web framework performance on raspberry pi
Asked Answered
A

2

6

I need to write a small Web based UI that would run on a raspi and since I'm trying to pull some Scala into my daily work, I'd like to use one of Play, Scalatra or Lift. Does anybody have experience with developing for Raspberry Pi with these frameworks? If so, which one is more advisable in terms of performance?

Altocumulus answered 16/1, 2014 at 15:41 Comment(2)
Play, Lift, even Scalatra or, really, Scala at all are probably nearly impossible on such a device. In addition to flavian's point about RAM, Scala is arguably only viable on desktop, server or what would qualify today as high-end mobile devices from a CPU speed and processor cache standpoint.Horde
@{flavian, Randall} :The pi B has 512 MB RAM, I wouldn't consider it a low memory environment. I've already used it with Scala and it works quite well actually, my concerns are about overhead from these frameworks.Altocumulus
G
11

People have reported very good low memory performance using Scalatra. One example write-up is at:

http://fehguy.tumblr.com/post/33760322808/my-house-heater-has-a-rest-api-with-phidgets-scala

Memory usage figures as low as ~30MB to ~40MB have been bandied about in blog posts and IRC conversations.

Some tips:

1) Scalatra allows you to select exactly the dependencies you want. The core HTTP router will work just fine on a Raspberry Pi - be extremely careful with selecting additional libraries and benchmark your memory usage whenever you add a new jar.

2) The current Scalatra g8 template will, by default, wire up precompiled Scalate templates for you. These are fine on a normal server, and it's usually very convenient to have things set up for you already, but in a memory-constrained environment they are the first thing you'll want to look at either ditching or optimising.

3) At least three people in the #scalatra irc channel on Freenode have already experimented with running it on a Pi, so depending on your use cases(s) their pain may be your gain.

4) You'll get the best possible memory consumption by launching your Scalatra app as a standalone Jetty servlet. This is detailed in the Scalatra standalone deployment guide.

Gaona answered 16/1, 2014 at 16:43 Comment(1)
I've actually made a first try with Play and although it needs around a minute to boot, it runs pretty good after that. If I run into any performance troubles, I'll consider Scalatra. Thanks!Altocumulus
A
3

Diego Medina blogged a while back about successfully using Lift on a Raspberry Pi: http://blog.fmpwizard.com/blog/lift-running-on-raspberrypi.

Attis answered 16/1, 2014 at 19:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.