How to handle high traffic on rest services?

0
In our application we have several rest services published. We are receiving alerts for high CPU loads when another system start's indexing the website for there search engine. The CPU load goes down after the jvm eventually restarts itself. Our services are being called around 46.000 times in one night.  I will contact them and see if we can change something in this behaviour, but for this post my question is: How to handle high traffic on rest services, in order to prevent the host machine to be overloaded no matter how many clients? Is it possible to set a max on the amount of clients?  
asked
4 answers
1

If the use case is loads of users making the same rest requests you could cache the whole response, reducing the load (I think an app store module called speedyrest or something exists for this purpose). But I guess this is not going to help you since these requests are probably all unique.

I don't think you can really guard against an attack like this in a Mendix application. Any Mendix application has always been easy to take down with a DoS attack.

For this specific example, as you already pointed out, the solution is probably to come up with a different interface for the specific purpose of allowing this other system to index your system.

answered
1

check out also  https://appstore.home.mendix.com/link/app/50207/WebFlight/SpeedyREST

or use a API gateway for throttling and caching as well

answered
0

Do you want these services indexed? If not, you could consider adding a robots.txt file to your theme folder. Good web crawlers will respect this file.

http://www.robotstxt.org/

answered
0

One of the most expensive things in REST is checking the username and password and creating a session out of those. So REST services without authentication are a lot faster.

answered