To Reduce Latecy for an API

These numbers are really ugly. A lot more information is needed to make any kind of diagnostic.

What are the characteristics (RAM, CPU, …) of the machine where the client is running?

What are the characteristics (RAM, CPU, …) of the machine where the API server is running?

What are the characteristics (RAM, CPU, …) of the machine where MongoDB is running?

What are the size of your collections?

What is the average size of documents? Sample documents from all your collections is usually very helpful to get. Because by books you might want to say book title or book reference of even the whole text of the book. We have no clue.

What are your indexes?

Sounds to me that you are doing some synchronous requests (one request per book once you get the book list) rather than using aggregation to gather some of the book attributes. So sharing your client code would be also useful.

2 Likes