Hi team,
Im bit new to mongo db, I am facing issue while fetching the data from database, I have a collection which has “_id, profileId, books” fields where books field consists of list of books where user can add through api and now while displaying the all the books for the profile its taking more time like 10 seconds depending upon the size of books(list of book objects) if i have 10 books its taking 10seconds and 5 books its taking 5 seconds although we are fetching single object using profileIf which I had this field indexed its taking huge time could you guys help me with this
Im using spring boot with java, response to java api itself is proportional to the size of the object
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.
@Nishi_Reddy, have you made any progress about this issue?
If the source of the problem is
please mark my post as the solution.
If it is something and you found the source of the problem please share with us so that others whom may face similar issue can use your thread to make progress on their own problem.
Please do not let your thread die. Without answers to the questions asked we cannot really help.
@steevej
I am using free tire cluster(M0) where by databases are located , My average size of collection is around 350 documents(records) and I have nested collections inside which I have mapped from java class(Book) when i fetch the single document using api by using findByProfielId(“1234”) which i have configured using spring data JPA its taking too long depending upon size of books(list<Books) field and had this field profileId indexed and i am trying to fetch single document
basic prolem I find is that its taking too much time to deserialize i.e blob to Java object while the viceversa saving the same object of list of 10books in books field is happening in less than a sec(763ms)
Basically I’m trying to fetch single Blob Object from db and its taking 10 sec while saving the same is taking less than a sec could anyone provide me a solution ?
@Data
public class BookAuthor implements FormAuditable {
When I do Java, I only use org.bson.Document and code my business logic using Facade design pattern. So I do not know the internal of de-serialization so from this on it is out of my league. But one thing you can investigate is the queries received by the server.