简体   繁体   English

限制Jackson REST API的调用

[英]Limit Jackson REST API's calls

I'm building a REST Api using Jackson. 我正在使用Jackson来构建REST Api。

As many standard APIs do, this is an interface between a front-end and various resources (databases and processing engines on different environments). 就像许多标准API一样,这是前端和各种资源(不同环境中的数据库和处理引擎)之间的接口。

GUI -> REST API -> Databases, HDFS, Hive etc. GUI-> REST API->数据库,HDFS,Hive等

What is a way to shield these resources from overloading? 有什么方法可以保护这些资源免于过载?

What would be a good design to limit the number of calls that my API does to these services but yet still "handle" the calls from the front end? 有什么好的设计来限制我的API对这些服务的调用次数,但仍然“处理”来自前端的调用?

You can follow below aproaches to shield these resources from overloading 您可以按照以下方法来防止这些资源超载

1) You can put up a in-memory cache over the service layer that interacts with databases resources.So these will reduces. 1)您可以在与数据库资源交互的服务层上建立一个内存中的缓存,这样可以减少这些缓存。

2)You can throttle your api calls.Therefore you can limit the no of api calls from a particular user. 2)您可以限制api调用,因此可以限制来自特定用户的api调用数量。 Reference - https://adayinthelifeof.nl/2014/05/28/throttle-your-api-calls-ratelimitbundle/ 参考-https: //adayinthelifeof.nl/2014/05/28/throttle-your-api-calls-ratelimitbundle/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM