On Mon, Sep 21, 2009 at 3:19 PM, espeed <james.thorn...@gmail.com> wrote:

> On Sep 21, 4:29 pm, David Pollak <feeder.of.the.be...@gmail.com>
> wrote:
> > Well.. there's a Java way of doing exactly that: fork/join on a thread.
>  Seehttp://java.sun.com/javase/6/docs/api/java/lang/Thread.html
> >
> > But to weave this into the page rendering, there would be some work
> required
> > on your part: forking the threads early in the page render cycle and then
> > harvesting their results as each snippet is called.
> >
> > It might be an interesting feature for Lift, however, to allow for the
> > forking of snippet execution that would be resolved at the end of page
> > rendering.  I've added a ticket to add this feature to Lift.
> Wouldn't it be more efficient to use lightweight actors for this
> instead of forking threads?  I have been looking at Erlang too and may
> be confused about the Scala actor model because I am new to Scala, but
> I thought one of the points of the Scala actor model is not to use
> threads in a case like this.

Threads are used in Scala actors, but only while processing a message (actor
jobs are allocated to threads in a thread pool).  In the case of asking your
external ad server for information, Scala Actors are not going to help you
because they have not been integrated with the JVM's NIO library (NIO ~=
Unix I/O Select)  Erlang's actor scheduler is IO aware, Scala's is not.

In terms of efficiency, having an extra 50-100 threads floating around the
JVM is not going to slow anything down noticeably.  Having an extra 2,000
threads will (lots of space for the stack and lots of entries in the
kernel's scheduler).

I expect that the actual Lift implementation will have a plugable design
such that we can use the standard JVM thread pooling or Akka actors (which
may benefit from not using an actual thread during IO waits).

> >

Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to