[英]Java Spring rest API - request per second handling
I have to write Rest Api which will be able to serve 30 requests per second.我必须写 Rest Api 它将能够每秒处理 30 个请求。 Project requirement is also that, app can not use bottleneck.
项目要求也是,app不能使用bottleneck。
I have to consume pokeApi https://pokeapi.co/api/v2/pokemon/ditto/ , and return weight, name and id.我必须消耗 pokeApi https://pokeapi.co/api/v2/pokemon/ditto/ ,并返回重量、名称和 ID。
Could You give me any tips how can I achieve 30 request per second?你能给我任何提示如何实现每秒 30 个请求吗?
Thanks !谢谢 !
Cache the response returned by https://pokeapi.co/api/v2/pokemon/ditto/
on first call, so that you don't have to make network call on every request.在第一次调用时缓存
https://pokeapi.co/api/v2/pokemon/ditto/
返回的响应,这样您就不必对每个请求进行网络调用。
30 req/sec seems doable on commodity VM with this approach.使用这种方法,在商品 VM 上 30 req/sec 似乎是可行的。
Assumption: No intermediate calls are happening to other services and DBs.假设:其他服务和数据库没有发生中间调用。
You can use asynchronous REST service.您可以使用异步 REST 服务。 Please see below link for implementation.
请参阅以下链接以了解实施情况。 https://www.thetechnojournals.com/2019/10/asynchronous-rest-service.html
https://www.thetechnojournals.com/2019/10/asynchronous-rest-service.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.