esme-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Pollak <>
Subject Elaborating on my Tweet about Actor suboptimality
Date Fri, 22 May 2009 16:57:14 GMT

I tweeted yesterday that I spent a good part of the day chasing Actor

Scala Actors have a bunch of memory retention issues.  These issues have
crept into the code over the last year or so.  Since the 2.7.2 release, I've
been identifying these issues and the EPFL folks have been fixing them.
They've gone from pretty gross (Actors always being referenced by the
library) to very subtle (a 16 byte retention per Actor create.)

Anyway, I've built a bunch of code into Lift to work around the memory
retention issues.  Lift uses reflection to periodically "clean house" in one
of the places that the Actors retain memory.  Lift also replaces the
Fork-Join based scheduler (a source of memory retention issues as well as
high CPU usage in multi-core machines) with a simple java.util.concurrent
based scheduler.

I spent yesterday dealing with the fallout of these Lift-related
work-arounds to the memory retention issues in the Actor library.  First, I
discovered that the Actor library synchronizes objects during certain
operations where code outside the library is invoked.  This led to a
deadlock situation.  I had to work around this issue in Lift (and have filed in response.)  I spent about
3 hours chasing a "messages not getting dispatched to certain actors"
issue.  It turns out that this was my mistake.  I used Actors based on the
old scheduling code before applying the fix to the scheduler.  Actors
created while the old scheduler was being used could not receive messages.
To fix this, I moved the "fix Actors" code to very early in the boot cycle.

More broadly, there's a discussion going on on scala-internals about what
can be done about Actors for Scala 2.8.  There are a lot of people
addressing the issue.  I have a high degree of confidence that they will get
to a reasonable solution for Scala's Actor library.  However, Scala's Actors
seem to be very heavy weight for what most apps I build (including ESME)
need.  I've been noodling with the idea of writing a very light weight Actor
library so that Lift has more control over this escential part of
interactive apps.



Lift, the simply functional web framework
Beginning Scala
Follow me:
Git some:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message