Play2.6.x开始使用Akka HTTP作为默认服务后端
所属分类 play
浏览量 592
Play 2.6.x之前,默认使用Netty服务后端 , 2.6之后版本 默认使用Akka HTTP
为什么会选择性能有所下降的Akka HTTP服务后端,Play项目的Tech Leader Greg Methvin的一些解释
Hi everyone,
I wanted to answer a few questions I have heard about Akka HTTP in Play 2.6.
Hopefully this should clear up any concerns people have.
Why is Play switching to Akka HTTP as the default server?
Play is switching for a few reasons.
Play already uses Akka and Akka streams internally,
and the model Akka HTTP uses for representing requests and responses is much closer to Play's.
Some of the improvements we plan to make in 3.0 will bring them closer together.
We are optimistic about the Akka HTTP project and where it's headed in terms of features and performance.
While both Netty and Play are active projects, it's much easier for us to work with the Akka team.
This is in part due to shared philosophy and goals but also due to the fact that both teams work for Lightbend.
This improved communication will help us implement new features and fix bugs and security issues more quickly.
What's the difference in performance?
Currently we have done no optimization, so the Akka server on 2.6.0-M1 is actually slower than the Netty server. This is expected.
We are working with the Akka team to bring the performance to the same level, or hopefully better.
You should see the improvements on prune as we continue this work.
Our contributor Christian Schmitt also published a gist with nice benchmarks showing
akka-http performance (without Play) actually exceeds that of play-netty-server in his test case,
in terms of both latency and bytes transferred.
Based on this and similar benchmarks we have done,
we expect to see comparable performance to Netty once we've removed the unnecessary overhead introduced in the conversion between Play and Akka HTTP models.
Does Play still support the Netty server backend?
Yes. We will continue supporting both Netty and Akka HTTP backends for the foreseeable future,
but will prioritize new features on Akka HTTP.
If you want to switch back to the Netty server, please see the Netty server documentation.
https://www.playframework.com/documentation/2.6.x/NettyServer
What about HTTP/2?
HTTP/2 is coming as part of the improvements being made to the Akka HTTP server and will be included in a future milestone.
We are interested in implementing it on Netty as well, but it's not a priority for the 2.6.0 release.
We'd gladly accept contributions from the community, though.
上一篇
下一篇
jdbc获取自增主键ID
pf4j简介及例子运行说明
pf4j 例子应用 类加载机制验证
guice循环依赖处理
guice根据名字注入消除歧义
scala函数式与非函数式写法比较