Nunit using alot of memory in RavenDB3 over RavenDB2.5

64 views
Skip to first unread message

Sebastian Claesson Hoffback

unread,
Aug 26, 2015, 4:41:47 AM8/26/15
to RavenDB - 2nd generation document database
Since we upgraded to RavenDB3 our tests are taking alot more time and taking up alot more memory.

Our 500 tests took about 7 minutes on my local machine and used no more than 400MB of memory in 2.5. Now in 3.0 it takes abour 35 minutes to run and uses over 2GB of memory. What is even worse is that Teamcity seems to hang completley when we try to run the tests (probably since it is an old server with not that much memory).

When we go back to 2.5 we immediately get our old performance back. 

I tried setting RunInMemory to false and it still takes up alot of memory. Is this a known error in RavenDB or can anyone help me how I find out what is wrong?

Our tests inherits from a baseclass that looks someting like this:
 
 
[SetUp]
public void Setup()
{
    var ravenContext = new RavenInMemoryContext();
    DocumentStore = ravenContext.DocumentStore;
}

[TearDown]
public void TearDown()
{
    DocumentStore.Dispose();
}
 

And the configuration is in this class:

public class RavenInMemoryContext : IRavenDbContext
{
    private readonly IDocumentStore _documentStore;
    public RavenInMemoryContext()
    {
        _documentStore = new EmbeddableDocumentStore
        {
            Configuration =
            {
                RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true,
                RunInMemory = true
            },
            EnlistInDistributedTransactions = false
        }.Initialize();
        IndexCreation.CreateIndexes(typeof(OneOfOurIndexes).Assembly, _documentStore);
    }
}

Oren Eini (Ayende Rahien)

unread,
Aug 26, 2015, 5:20:13 AM8/26/15
to ravendb
What build are you using?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sebastian Claesson

unread,
Aug 26, 2015, 5:29:04 AM8/26/15
to rav...@googlegroups.com
We use build 3.0.3690

--
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/4kOCXcOGrAo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Sebastian

Sebastian Claesson Hoffback

unread,
Aug 26, 2015, 5:30:07 AM8/26/15
to RavenDB - 2nd generation document database
We use build 3.0.3690

/Sebastian

Oren Eini (Ayende Rahien)

unread,
Aug 26, 2015, 5:38:39 AM8/26/15
to ravendb
Can you try to run a memory profiler on this, see what is actually making use of it?
Also, can you try build 3780?

Sebastian Claesson Hoffback

unread,
Aug 26, 2015, 8:00:08 AM8/26/15
to RavenDB - 2nd generation document database
Tried build 3780 now and we are seeing the same behavior. It used a little less memory (only 1,7GB) but still to much.

I will now try a memory profiler and see if i can find anything.

/Sebastian

Sebastian Claesson Hoffback

unread,
Sep 29, 2015, 2:29:21 AM9/29/15
to RavenDB - 2nd generation document database
Sorry for the long wait. We had to release so we stayed with Raven 2.5 and will try again with Raven 3 for the next release.

But I finally got around to looking at our tests with a memory profiler. I noticed that our ninject Ninject.Activation.Caching.Cache was full of Raven.Database.Client.EmbeddedDocumentStore-objects even though we dispose them for each test. That was not enough so the fix was to clear that cache manually after each test. Now our test are even faster than before :)

[TearDown]
public void TearDown()
{
   DependencyManager.NinjectKernel.Components.Get<ICache>().Clear()
   ...
}


Kamran Ayub

unread,
Apr 26, 2016, 11:50:48 PM4/26/16
to RavenDB - 2nd generation document database
I just want to say thanks, I was Googling around the group before I posting a thread--and I decided what the heck, let's try your solution... yeah it totally solved my unit test memory issue. Now I can run my tests properly on Azure! Before it was reaching the memory limit of the Free tier and aborting the build/test run.

Sebastian Claesson

unread,
May 11, 2016, 3:36:07 PM5/11/16
to rav...@googlegroups.com
That is awesome, you are welcome. Always fun to be able to help someone :)

/Sebastian


--
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/4kOCXcOGrAo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Sebastian
Reply all
Reply to author
Forward
0 new messages