Asynchronous I / O – Java

I've been looking for details about the benefits of asynchronous I / O in Java, especially from application stack design

I have encountered many examples of event driven servers, such as node JS, tornedo et al

What I can't understand is why the entire application stack of JBoss or Weblogic application server is migrated to event driven architecture in Java EE

Even these servers support non blocking I / O. yes, they are allocating a thread for each request, but if there is a thread pool, are the resources within the range of good performance parameters?

Please give me some advice in the following way

>Why use the traditional Java EE architecture of Apache Tomcat / JBoss / Weblogic to consider turning to event driven architecture. > Does the event driven architecture help provide device independent websites / applications. > When designing applications on the cloud, we will choose asynchronous I / O. > whether the performance of event driven architecture is better than that of traditional Java EE architecture is still a myth

Solution

A key concept you mentioned is:

It has been proved time and again that when your goal is to support a large number of concurrent users, each thread requesting an IO bound application will eventually exhaust your thread pool It turns out that the framework you are talking about, such as node JS, tornado, etc. are good at handling a large number of concurrent users. Your application is most likely just waiting for something to happen and does not do any tasks with complete CPU constraints In other words, these tools are very suitable for building real-time applications, such as online games, chat rooms, logging systems and notification systems. Their main goal is to quickly coordinate small message delivery with many users as soon as possible

In fact, these tools are excellent at writing web socket based applications because they actually provide users with real-time or near real-time experience

Although many companies do use these platforms from the beginning, I think traditional stack companies often use event driven tools as a supplement to their systems When you use something like node JS or tornado, you may find yourself abandoning many built-in software you rely on and having to use your own API and driver node. JS has existed for some time. In fact, there are many supports to connect to the database, NoSQL platform and build the system, but it takes some time to implement

As an experiment, try to write a simple TCP chat application, use one thread per request, and see how many users you can support Eventually, you will reach the limit of how many OS threads you can start, which is really expensive

Then take a look at the use of a thread (that is, the default thread) in node JS You will find that a very large number of concurrent requests can be supported per second As we all know, it can be extended to millions because it is not limited by threads. It is only limited by memory, the number of file descriptors and CPU

Try my best to answer your question:

>I think just because you heard node JS and event driven architecture are so simple that it is not feasible to abandon the whole platform If you need to build a highly concurrent application with IO binding, you really have to ask yourself If so, why not use it to supplement your existing stack? > I'm not sure about your second question. What does your device mean? > You can build great applications in the cloud based on traditional tools, just like using event driven architecture In fact, it may be a "cloud" application, which is actually independent of the choice of platform. > I want to talk more about scale than performance You may find node JS applications run slower or faster than Java applications running the same code But node What JS can do is to allow higher throughput because it will not reach the thread limit I mentioned This also means that you have built an appropriate event - driven application and you will not block it If you stop, you take down the whole system!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>