java - 请教下各位jetty在什么场景下适合使用?
巴扎黑
巴扎黑 2017-04-17 17:43:16
0
3
330

近期看到一个基于node的前后端分离方案,别人是这样做的:nodejs做前端渲染,然后通过REST接口调用后端java的业务逻辑(都是独立部署的服务器)。它这里java的业务逻辑是部署在jetty上。我想请教下各位,这种方案有什么好处吗?

我自己的理解是node和java之间采用的是长链接,而jetty在这方面相对tomcat有优势。不知道各位怎么看,大家都在什么场合会用jetty?

巴扎黑
巴扎黑

reply all(3)
迷茫

Used during development because it starts up quickly
A bit off topic

Ty80

jetty and tomcat are both called application servers. But jetty provides two ways to start.
One is embedded, which is to start a jetty by writing code yourself.
Another deployment method, which is the same as tomcat, deploys a war package into jetty.
Because of embedded deployment, the flexibility is better. Your code deployment does not need to rely on operation and maintenance to deploy a tomcat in each environment.
To put it simply, there is one more method, giving developers more choices.
Of course, jetty came out later than tomcat, so in terms of performance and architecture implementation, it is relatively better than tomcat.

As for the solution mentioned in your question, it just uses some new technologies (nodejs) to completely separate the front and back ends, which may be more efficient in development.

迷茫

I don’t know whether the long connection you are talking about is WebSocket, Comet or HTTP Keep-Alive. Both Jetty and Tomcat support all three. In terms of performance:
WebSocket and HTTP Keep-Alive are industry standards, and there will not be much performance difference between the two;
Comet, the APIs of Jetty and Tomcat are different, because there is no unified standard in the industry, but the performance is personal I don't think there will be much difference, because both support NIO.

As for the choice between the two, it may be more a matter of personal habits (for example, I personally like Jetty), or company regulations or something.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template