简体   繁体   English

Java Play Framework 1.4x - 开发服务器

[英]Java Play Framework 1.4x - Development Server

I am interested in what Development Server does Play use under the hood?我对 Play 在后台使用什么开发服务器感兴趣? (Web & Application server) (网络和应用服务器)

While developing locally i have huge page load times (5-10 seconds) comparing to deployed application page loads (1-2 sec).在本地开发时,与部署的应用程序页面加载(1-2 秒)相比,我有巨大的页面加载时间(5-10 秒)。 I suppose something is wrong with development server since there is a huge difference in speed.我想开发服务器有问题,因为速度存在巨大差异。

Is there a specific location of the development server Play.有没有开发服务器播放的具体位置。 1?4 uses? 1?4 次使用? Can i switch development server?我可以切换开发服务器吗?

Play uses netty, but the performence difference is because in dev mode all the frameworks (not only play) disable all kind of caches or precompiled things and recompile everything all the time to have a good dev experience, in production things are compiled only once. Play 使用 netty,但性能差异是因为在开发模式下,所有框架(不仅是 play)都禁用所有类型的缓存或预编译的东西,并一直重新编译所有东西以获得良好的开发体验,在生产环境中只编译一次。

Play FW uses a single thread in DEV mode(default) for better debugging. Play FW 在 DEV 模式下使用单线程(默认)以进行更好的调试。 If you have blocking threads (multiple queries being excuted with ajax requests etc), the others will be waiting for that thread to be released.如果您有阻塞线程(使用 ajax 请求等执行多个查询),其他线程将等待该线程被释放。 So you will have longer wait times relative to deployed version.因此,相对于已部署的版本,您将有更长的等待时间。

You can change this behaviour to use specified number of threads (eg 5), in application.conf like this:您可以在 application.conf 中更改此行为以使用指定数量的线程(例如 5),如下所示:

# Default to 1 thread in DEV mode or (nb processors + 1) threads in PROD mode.
# Try to keep a low as possible. 1 thread will serialize all requests (very useful for debugging purpose)
play.pool=5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM