[Lift] Concurrent Web Service Requests?

2009-09-21 Thread espeed

I have been researching Web frameworks that will take advantage of
multi-core chips, and I'm trying to get a picture for how Lift uses
Scala's event-based actors for incoming page requests and how an
application developer would use actors in Lift to make concurrent Web
service or DB requests.

From what I understand, incoming page requests are initially handled
by a thread and then passed off to an event-based actor so the thread
isn't tied up during the entire page request. For pages that are
composed of data from multiple Web services or multiple DB calls, the
page's app developer would create multiple event-based actor requests
to the different Web services or the DB, depending on where the data
is located. Correct? -- And if so, is there an example of how to do
this the Lift way?

Also, does Lift use the Scala event-based actors library its own?

Thank you.

James






--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Concurrent Web Service Requests?

2009-09-21 Thread espeed

On Sep 21, 2:33 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Lift only uses event-based Actors for supporting CometActors.  All parts of
 the standard HTTP request/response cycle (except for the CometActors) are
 handled on a single thread.

Hi David -

Thanks for your quick response. If an app developer wants to
parallelize requests to Web services, what is the recommended way to
do this in Lift?

For example, in Rails you might do something like this, where the time
to gather all the data for the page is limited to the longest request
instead of the sum of all requests:

t1 = Thread.new do
  @news_data = NewsClient.getNewsData()
end
t2 = Thread.new do
  @advertisements = AdsClient.getAdsByLocation(zip)
end
t1.join
t2.join

Is there a Lift event-based actor API for this or what is the Lift way
of doing this?

Thanks again.

James



--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Concurrent Web Service Requests?

2009-09-21 Thread espeed

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.

--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Lift Download Instructions for Linux (Maven Installation Instructions)

2009-09-18 Thread espeed

The Lift download instructions for Linux says:

For linux, we recommend that you use your native package management
system to install maven. If you are unsure how to do this, please
refer to your OS documentation.

However, the maven2 version for the the yum package on Fedora is maven
2.0.4, which is not current enough because mvn -e archetype:generate
will fail with Required goal not found: archetype:generate.

Downloading the source and following the source installation
instructions resolves the issue -- 
http://maven.apache.org/download.html#Installation

I suspect that many of the maven packages are not current for the
various distributions so it would probably be beneficial to update the
Lift download instructions to reflect this.

James Thornton


[ja...@fedora espeed]$ mvn -e archetype:generate
/usr/lib/jvm/java
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] Ignoring available plugin update: 2.0-alpha-4 as it requires
Maven version 2.0.7
[INFO] Ignoring available plugin update: 2.0-alpha-3 as it requires
Maven version 2.0.7
[INFO] Ignoring available plugin update: 2.0-alpha-2 as it requires
Maven version 2.0.7
[INFO] Ignoring available plugin update: 2.0-alpha-1 as it requires
Maven version 2.0.7
[INFO]

[ERROR] BUILD FAILURE
[INFO]

[INFO] Required goal not found: archetype:generate
[INFO]

[INFO] Trace
org.apache.maven.BuildFailureException: Required goal not found:
archetype:generate
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor
(DefaultLifecycleExecutor.java:1533)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds
(DefaultLifecycleExecutor.java:381)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute
(DefaultLifecycleExecutor.java:135)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:
430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO]

[INFO] Total time: 1 second
[INFO] Finished at: Fri Sep 18 19:23:30 CDT 2009
[INFO] Final Memory: 2M/5M
[INFO]


--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---