如何在没有微服务的情况下缩放一个特定的REST API?

发布于 2025-01-29 01:25:29 字数 137 浏览 2 评论 0原文

我正在使用Spring开发Web应用程序后端,客户和服务器通过RESTFUL API进行对话。在某个特定的API中,我认为命中会大大。有什么方法可以扩展此特定的API?(例如,分配更多线程) 在此应用中,一切都是相互依存的。因此,我猜微服务不会成为最好的方法。

I am developing web application backend with Spring where client and server talk through Restful APIs. There is a specific API where I assume the hit will be much. Is there any way to scale this specific API?( Like, assigning more threads)
In this application everything is interdependent. So, microservice wont be best approach I guess.

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

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

发布评论

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

评论(2

鹿! 2025-02-05 01:25:29

有两种可能的方法,我可以想到

  • 使用负载平衡器,这将帮助您添加REST API的多个应用程序实例。在这种情况下,这是经典的方法。

  • 这取决于现有的实现,API可以是重组只接收消息并将处理线程解除。

您建议的增加线程的方法具有限制和更微调的要求。如果用例仅支持有限的用户,则可以使用以下配置。 tomcat线程池

There are two possible ways, i can think of

  • Use Load Balancer, this will help you to add multiple application instances of Rest API. This is classical approach in such cases.

  • This depends upon existing implementation, API can be refactor to just receive the message and decouple the processing thread.

The your suggested way of increasing thread has limitation and more fine tuning require. If the use case is just to support limited user, following configure can be use. tomcat thread pool.

宁愿没拥抱 2025-02-05 01:25:29

只有多个相同服务的实例。 REST具有无状态的约束,因此很容易做到这一点。

Just have multiple instances of the same service. REST has a statelessness constraint, so it is easy to do it.

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