Let\'s say, I have P processes running some business logic on N physical machines. These processes call some web service S, say. I want to ensure that not more than X calls
Bucket4j is java implementation of "token-bucket" rate limiting algorithm. It works both locally and distributed(on top of JCache). For distributed use case you are free to choose any JCache implementation like Hazelcast or Apache Ignite. See this example of using Bucket4j in cluster.