Search code examples
javajax-rswildflyresteasy

Wildfly - RestEasy, JAX-RS : limit request per second for user/ip


I've some simple jax-rs web-services as EJB for an e-commerce. I'm using Wildfly 9 and restEasy.

I want to serve my data to a lot of users, but i want to limit the request/seconds that a user can do.

I want to prevent some DoS attack or scraping system : an user(bot) could read all the products each second and the other users will wait.

Is there some system to block request per user per second? For example "at least 10 request/second per user".


Solution

  • Bozho has implemented a simple one and discusses the pros and cons here.

    This article also mentions Guava's RateLimiter.

    The last update of the blog entry also mentions bucket4j.