Benchmark Elastic-Search vs Raven-DB for Reading collections of data in .Net Core:

last week , we decided to make a decision to choose between Elastic-Search & Raven-DB for reading data in our service .Before going into the technical details I want to describe the model in which used in our query.

We have two Query , the first One reading All GradeFields with Grade,Field and Level information in the output Model.And the second One is reading all books belong to an specific GradeField.

At first I imported data from SQL Server to both the NoSQL stores.But for ease of reading data , GradeField Table has flattened in one Index in the NoSQL Model.

Raven-DB has written in .Net Core and it’s very handy for .net developers to use as a document based NoSQL in their projects.Also,It has a great tools for importing data from CSV and SQL Server database.

Also for importing data to Elastic,I’ve written a simple tools to map JSON file to an index with bulk insert,and you can find it in this GitHub repository:

Both Raven & Elastic have a rich client API for .net core (NEST and RavenDb.Client),so you can easily use it in your .Net Core APP.

GradeField and Book Output model are like :

public class GradeField 
public int Id {get;set;}
public string GradeTitle {get;set;}
public string FieldTitle {get;set;}
public string LevelTitle {get;set;}
public class Book {
public int Id {get;set;}
public string Code{get;set;}
public string Title{get;set;}

Below Code is getting data from RavenDB:

using (IAsyncDocumentSession session = store.OpenAsyncSession())
List<GradeField> gradeFields = await session

And for Elastic:

var searchResponse = await client.SearchAsync<GradeField>(s => s
.Query(q => q

Since our main metric was quality of handling request by increasing concurrent users, I used Apache JMeter as a tool to measure max request time by increasing User loads to API Calls.

So in summary, the final result was :

In conclusion, although Raven-Db as it said in his documentations,is a No-SQL Database that is good for OLTP purposes,but it is good choice when you are in .Net platform , and it is important to you to have an easy experience of development with a document based No-SQL with support of ACID.

But when it comes to performance in fetching data , Elastic is very powerful technology, but a little hard to use in complex scenarios.

It depends on your problems and your priority,But if you want to have a great performance in reading and filtering data, Elastic is better choice.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mortaza Ghahremani