incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: Scala view server?
Date Fri, 20 Aug 2010 18:42:10 GMT
On Fri, Aug 20, 2010 at 2:26 PM, Jon Brisbin <> wrote:
> I'm looking at the scouchdb Scala view server and trying to write my own version that
doesn't compile arbitrary Scala code but simply links to existing, pre-compiled classes. I
have a question about the way view servers work, though:
> Does each view create its own command process (and thus JVM)?
> I started down a garden path of using Akka remote actors to link the view server calls
to objects that actually perform the work but I'm noticing that an "add_fun" call doesn't
say what view its associated with, so I have to assume that each view instantiates its own
JVM, helper objects, etc...
> Does it call the command-line I give it (right now a Bash script that calls my Scala
class) for every request of the view or does it reuse processes already started (like pooling)?
> The more I get into this, the less feasible it seems to tie some JVM-based view language
to Couch and still keep it performant.
> What about the Erlang to Java bridge (JInterface)? Could this be used instead of the
command-line style view server to hook into a long-running JVM process (like Akka remote Actors)?
> Thanks!
> J. Brisbin

During a view build, a single process is used. Between two builds,
different processes may be used. If two builds are occurring
simultaneously, they will use two separate OS level processes. The
add_fun will re-add the function each time it starts a view build. The
reset command should remove references to installed functions.

I think you could be right in that it'd be hard to integrate a JVM for
view processes because of its memory footprint in some situations with
lots of simultaneous view builds. I was going through and refactoring
some of that code to behave a bit more nicely which would provide the
ability for you to do something with JInterface semi easily (i've
never worked with it directly, but the couch side would be easier than
it is currently).

No idea if/when I'll finish that work though. I hit a stumbling block
with performance not improving much with the various optimizations I
had so I have to go back and do some profiling to figure out what's
going on.

Paul Davis

View raw message