如何在Java EE中处理过多的Rest请求?

huangapple 未分类评论43阅读模式
英文:

How to Handle too many Rest requests in Java EE?

问题

我正在处理一个JavaEE 8应用程序,其中有一个如下所示的rest端点。

我使用Jboss EAP 7.2作为应用服务器,线程池数量为1000,有界队列线程池数量为900。

这个rest请求在`someBusiness.sendResponse(message04);`中具有一些验证业务,还调用另一个soap请求并等待它响应,然后返回结果。

有时这个soap请求花费的时间太长,问题是,当我在这个端点上有大量请求,比如每秒40000个请求,这将导致超过我在jboss中设置的那些池。我失去了一些请求。我不能让这些soap端点更快地完成它们的工作,也不能将我的jboss线程数设置超过1000,因为涉及到一些业务。

在像这样的大公司中,针对这种情况的解决方案是什么?你有什么建议(技术或框架)?我可以自由地使用任何我想要的技术,比如mq、kafka或任何其他的,但我想要的是大公司采用的最佳实践。

英文:

I'm working with a JavaEE 8 application that has one rest Endpoint shown as below.

I use Jboss EAP 7.2 as Application Server that has thread-pool count 1000 and bounded-queue-thread-pool count 900.

This rest request has some validation businesses in someBusiness.sendResponse(message04); and also calls another soup request and wait for it to response then response back result.

Sometime this soup request takes too much time , and the problem is that when i have heavy request on this endpoint like 40000 per sec this will make more than that pools i've been set in jboss.and i lose some of requests.i cant make those soup endpoints to do faster their works and cant set my jboss thread more than 1000 cause of some businesses.

What is solutions for situations like this in large companies?what you suggest(technologies or framework)? i can freely use any technologies i want like mq kafka or anything but i want best practices that large companies do.

@Stateless
@Path("/")
public class PaymentIDInquiryImpl {


@EJB
SomeBusiness someBusiness;

@Produces(MediaType.APPLICATION_XML)
@Consumes(MediaType.APPLICATION_XML)
@Path("/SomeInquiry")
@POST
public Message04 getPaymentIDInquiry(Message01 message01) {
    return someBusiness.sendResponse(message04);
}
}

huangapple
  • 本文由 发表于 2020年7月27日 17:22:14
  • 转载请务必保留本文链接:https://java.coder-hub.com/63112302.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定