Http Service崩溃的原因

发布于 2024-12-13 04:32:37 字数 342 浏览 2 评论 0原文

我们有一个外部系统(不在我的控制之下),上面运行着一个 Http 服务,我们可以使用 Java 的 HttpURLConnection 对象。现在,由于某种原因,服务在调用特定请求时崩溃。我想知道从客户端角度来看 Http 服务崩溃的可能原因是什么,除了像连接泄漏这样的资源消耗。请注意,当它被同时调用多次(超过 50 次)且负载较小时,就会发生这种情况。如果有人可以提供相同的建议,我将不胜感激。

We have an external system (not under my control) which has a Http Service running on it and we can invoke the service using Java's HttpURLConnection object. Now, for some reason the service crashes upon invocation of a specific request. Am wondering as to what can be the likely causes of Http Service to crash from the client perspective other than lets say resource hogs like a connection leak. Note that this happens when it is called many times (over 50) at the same time and not under less load. Would highly appreciate if anyone can provide recommendations around the same.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰沐子 2024-12-20 04:32:37

除非笼统地回答,否则这是不可能回答的。

看起来您正在使服务过载,并且过载的服务可能会因多种原因而崩溃,包括:

  • 过载引发的资源泄漏
  • 资源匮乏(由于一次执行太多操作)
  • 超时处理不正确以及过载导致的其他错误
  • 等触发的同步错误(竞争条件、死锁等)
  • 由后端服务过载

我看不出列举可能性对你有什么帮助。您确实应该与控制您超载的服务的人员交谈。询问他们您的客户应该进行多少个并发呼叫。


如果有人可以提供相同的建议,我将不胜感激。

我的建议是减少并行发出的请求数量。该服务(任何服务!)每秒只能处理一定数量的请求。如果超出该容量,您将无法获得更好的服务。相反,您可能会导致性能问题,从而显着降低服务的吞吐量……甚至使其崩溃。

运用你的常识。做一名优秀的网络公民。

This is impossible to answer except with generalities.

It looks like you are overloading the service, and an overloaded service can potentially crash for any number of reasons including:

  • resource leaks triggered by overload
  • resource starvation (due to doing too many things at once)
  • incorrect handling of timeouts and other errors cause by overload
  • synchronization bugs (race conditions, dead-locks, etc) that are triggered by overload
  • overloading of backend services
  • and so on.

I can't see how enumerating the possibilities is going to help you. You should really be talking to the people who control the service that you are overloading. Ask them how many concurrent calls your client should be making.


Would highly appreciate if anyone can provide recommendations around the same.

My recommendation is to reduce the number of requests you are making in parallel. The service (any service!) can only cope with a certain number of requests per second. If you exceed that capacity you won't get better service. On the contrary, you are likely to cause performance problems that will significantly reduce the service's throughput ... or even crash it.

Use your common sense. Be a good network citizen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文