I have created Android App for news website (wordpress), i used WP v2 API to get posts from database, the problem that even less than 10 users that using the App in same time can overload the server (CPU usage).
When user open the App i send get
request (using retrofit2) and get the first page (json array with 10 objects of that represent posts).
/wp-json/wp/v2/posts?page=1
Then for every post i send another request for media to get image.
/wp-json/wp/v2/media/21342
Without the App the server overloads when 600-700 users browse the website, with the App it overloads at 300 users and 10 App users.
Why it happen what is the difference between wp-v2 request and browser website loading?
Try to reduce the number of requests by passing down the image URL with the inital request. I have done this using this embedded
parameter:
https://developer.wordpress.org/rest-api/using-the-rest-api/linking-and-embedding/
Additionally, maybe try using something like S3 Offload Media plugin to serve your images off of a different server than your application server.
Pantheon has a whole site dedicated to WP at Scale: https://scalewp.io