Playframework(13)Update Version and pick up the knowledge
1. Pick up the Old Knowledge
Our company is using the old version http://downloads.typesafe.com/releases/play-2.0.4.zip
Just follow the blog and set up all these things.
>play eclipsify
Then can be import to eclipse
>play idea
Import to intellij
deployment
>plan clean compile stage
>target/start
>target/start -DapplyEvolutions.default=true
Or
>play dist
>play -Dconfig.file=path/file dist
>start -Dconfig.url=http://conf.mycompany.cm/conf/prod.conf
>start -Dhttp.port=9998
>start -Dhttp.port=1234 -Dhttp.address=127.0.0.1
Handling Asynchronous Results
def index = Action {
val promiseOfResp = Akka.future {
Ok("")
}
Async {
promiseOfResp.map(resp => resp)
}
}
Thread Pool
https://www.playframework.com/documentation/2.3.1/ThreadPools
http://stackoverflow.com/questions/24579030/play-framework-what-happens-when-requests-exceeds-the-available-threads
https://www.playframework.com/documentation/2.1.0/ThreadPools
https://www.playframework.com/documentation/2.0.4/ScalaAsync
Based on the document, there is default thread pool configured to support multiple thread, but there is thread VS events. So the suggestion is to use events and threads.
Threads is configured based on the cores.
We use Promise to do asynchronous requests to support multiple events.
Threads For Spray
http://spray.io/documentation/1.2.1/spray-can/
http://spray.io/documentation/1.2.1/spray-can/configuration/
http://doc.akka.io/docs/akka/2.1.4/general/configuration.html?_ga=1.238217664.1729015399.1407273046
It seems to be
default-dispatcher {
type = “Dispatcher”
executor = “fork-join-executor”
for-join-executor{
parallelism-min = 8
parallelism-factor = 3.0 #ceil(available processors * factor)
parallelism-max = 64
}
}
2. Latest Play and Typesafe Activator
Download the latest activator
>wget http://downloads.typesafe.com/typesafe-activator/1.2.8/typesafe-activator-1.2.8-minimal.zip
Unzip it and place it in the working directory, add the command to the path.
>activator ui
Here is the source codes
https://github.com/typesafehub/activator
This command will be perfect.
>activator ui -Dhttp.address=0.0.0.0 -Dhttp.port=8888
That can build the project based on the ui. Or we do it in command line.
>activator new easyplay play-scala
>cd easyplay
>activator
Then the same thing, visit this page to go on
http://localhost:9000/
References:
Playframework 1~12
http://sillycat.iteye.com/blog/1743396
http://sillycat.iteye.com/blog/1750340
http://sillycat.iteye.com/blog/1750947
http://sillycat.iteye.com/blog/1751649
http://sillycat.iteye.com/blog/1752183
http://sillycat.iteye.com/blog/1752579
http://sillycat.iteye.com/blog/1753450
http://sillycat.iteye.com/blog/1754139
http://sillycat.iteye.com/blog/1754381
http://sillycat.iteye.com/blog/1756342
http://sillycat.iteye.com/blog/1757098
http://sillycat.iteye.com/blog/1774803
https://www.playframework.com/documentation/2.0.4/IDE
https://www.playframework.com/documentation/2.3.x/NewApplication
Playframework(13)Update Version and pick up the knowledge
猜你喜欢
转载自sillycat.iteye.com/blog/2103749
今日推荐
周排行