Play framework with Request Limiter

本文介绍了如何在Play框架中实现请求限流,包括应用级别、代理级别和负载均衡级别的多种限流策略。探讨了通过自定义过滤器限制并发请求的方法,并提到了Node.js代理、HAProxy及NGINX等工具在限流中的应用。
Play framework with Request Limiter

1 Application Level
object ConcurrentRequestsLimiter extends Filter {}
We can access to the RequestHeader.

object LoggingFilter extends EssentialFilter {}
We can access to the whole Request.

We can limit the concurrent requests for Playframework.

2 Proxy Level
Limit the requests on NodeJS proxy
https://journal.paul.querna.org/articles/2010/09/04/limiting-concurrency-node-js/

Maybe I need to put a limit rate on my Playframework to protect my server side.

3 LoadBalance Level
HAProxy
http://blog.serverfault.com/2010/08/26/1016491873/

https://blog.codecentric.de/en/2014/12/haproxy-http-header-rate-limiting/

NGINX
http://nginx.org/en/docs/http/ngx_http_limit_req_module.html
http://serverfault.com/questions/179646/nginx-throttle-requests-to-prevent-abuse

References:
Controller the Concurrent Users/Requests
https://github.com/inoio/play-requests-limiter

Filter
https://www.playframework.com/documentation/2.4.3/ScalaHttpFilters
https://www.playframework.com/documentation/2.3.4/ScalaInterceptors

Find a way to Perf Testing
http://sillycat.iteye.com/blog/2109369
https://github.com/luohuazju/sillycat-gatling
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值