开发者

How Play Framework can make it possible to deploy web applications that runs faster than traditional Java frameworks?

开发者 https://www.devze.com 2023-04-12 05:43 出处:网络
Play Framework does not follow Java Servlet specification. I am trying to understand how this enables web application developed with Play Framework run faster than if the sam开发者_如何学Ce applicatio

Play Framework does not follow Java Servlet specification. I am trying to understand how this enables web application developed with Play Framework run faster than if the sam开发者_如何学Ce application was developed say using Struts or Spring MVC?

How does it affect the performance if I deploy Play framework developed application under Tomcat as opposed to using Netty?


Play! is more than just a framework like Struts or Spring, you can also think of it as an environment the applications can run in.

You can deploy Play! apps in a J2EE container like Tomcat, but you don't have to, as Play comes bundled with Netty, which it uses as a web-server.

As a container, Play! differs from Tomcat in that:

  1. It is stateless, so it doesn't create a session per connection. This might give some performance benefit, depending on your application.

  2. It supports asynchronous I/O through continuations, and rather than following the standard servlet container one-thread-per-request model, you service all your concurrent requests with a much smaller thread-pool. This might allow you to scale your application more efficiently, but it requires a different approach to programming than you might be used to in a normal servlet container.

Those are two things I can think of where Play! differs from the standard servlet spec way of doing things which may have an impact on run-time performance, there may be more, and it all depends on the nature of your application as to whether these facets aid you or not.

As to your second question, about bundling Play apps and deploying them under Tomcat, you would expect this to cause your overall performance to degrade, as this would add a lot of overhead which is not required.


Play is faster in development because your have quick round-trips. It's not necessary to compile and restart a server. The reload mechanism is really good and much better then Tomcats. So there Play is faster.

However compared to other java-webframeworks Play is sometimes faster sometimes slower. For example the groovy template engine has a bad performance. This can be solved by using Japid. So the main reason to don't use the servlet-api is simplicity. You can read it in detail in G. Bort, Why there is no servlets in Play. Performance was not the main goal.

If you run play-apps in Tomcat I would guess it's a little bit slower. The recommended way is the play-server combined with an reverse proxy.

Hope this answer your question.

0

精彩评论

暂无评论...
验证码 换一张
取 消