Glassfish: limit number of requests a user can make per second/minute
Ok I've been doing some googling about this and I haven't found anything definitive.
Is there a preferred way of limiting the number of a requests a user can make to an application running on Glassfish per time-interval (second, minute, whatever)?
For example what I'm looking for is if user1 makes 4 requests in one second the container will ignore any further requests from that user/ip for some amount of time.
It would be reasonably easy to implement this programatically but in that case you'd still be processing the reques开发者_如何学运维ts, however briefly. If this could be handled in a more lightweight way by the container before entering the actual application(s) ... seems like it would be preferable.
I don't see why this is something the container would handle. It seems it would be just as easy to implement the solution (as you state) as it would be for the container so I don't think having the container do it would buy you much.
Maybe you could try solving this at the network level especially if you're trying to prevent a DDOS attack or something.
精彩评论