7

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?

biesior
  • 55,576
  • 10
  • 125
  • 182
Chirlo
  • 5,989
  • 1
  • 29
  • 45
  • 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. – Randall Schulz Jan 16 '14 at 16:36
  • 2
    @{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. – Chirlo Jan 16 '14 at 18:32

2 Answers2

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.

futurechimp
  • 554
  • 4
  • 6
  • 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! – Chirlo Jan 31 '14 at 09:56
3

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

Dave Whittaker
  • 3,102
  • 13
  • 14