Performance Issues with RavenDB

I created a simple application based on RavenDB, where I have 3,000 documents consisting of 15 string and int properties. One of the properties (CType) has the same value for all documents, and I use this field as a way to load all documents into an array using the Lucene query:

var store = new DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "GIS" }; store.Initialize(); using (var session = store.OpenSession()) { var school = session.Advanced.LuceneQuery<School>() .Where("CType:School") // all documents have CType = "School" .Take(5000) .ToArray(); 

This code works in that it reads all 3,000 documents into an array, but it takes 5 seconds or more to complete the download.

Is there any way to do this faster?

+4
source share
2 answers

Well, you are fulfilling a query that should receive 5,000 items, send them over the network and deserialize them from Json to School POCO. 1000 pieces per second are not so bad for all this.

Having said that, what will happen to the list of School items that you will return? As a rule, you do not need to use 5000 elements 1 time, so RavenDB has a built-in paging

+3
source

In fact, you are using a dynamic index for this, so it is likely that the first time you get it using a dynamic index. And you really should consider filtering on the server, not on the client.

+1
source

Source: https://habr.com/ru/post/1387182/


All Articles