Limit the REST API calls

0
Hello, I am trying to limit the rest api calls using Mendix Marketplace - Ratelimiter module.  My use case is that to not allow a single client more than x amount of call to a specific endpoint in a specific timeframe. so e.g. computer b is not allowed to call /status more than 5x a minute and show message to user.   When I use the rate limiter module, I always gets the delay in API response instead of coming out of the loop after specific time. I added JA_ExecuteWithRateLimit action inside the Get Rest API microflow.  Can anyone help me the steps to implement this?     Or any other way to do this?    
asked
1 answers
0

Hi Raghavendra Bhagwat,

 

It's quite a challenge to implement a rate limiter in Mendix, as using regular Mendix building blocks is stateless at runtime, and always retrieves some state from the database.

With high-speed functionality, like rate limiting, retrieving from database might be too slow as it costs roughly ~30 ms to retrieve something.

If it's not that time-sensitive, this might just work. Otherwise, you might want to look into stateful storing stuff via Java. Remember that your application may run in a multi-node environment.

 

Good luck!

 

answered