1

I'm using RavenDB .Net client 2.5.2700 and server build 2700.

Calls to DocumentStore.Initialize() are taking 21 seconds and change even when the server is warm.

Watching with Fiddler the call to Raven/Databases/<database> returns nearly immediately but the client waits for the call to databases/<database>/docs/Raven/Replication/Destinations to return a 404 which takes quite a while. I do not have the replication bundle installed/enabled on the server and I'm fine with the client being aware of that fact.

Is there any way to configure the DocumentStore on the .Net RavenDB client so it skips the replication check?

Here's the simplest example of my connection, this is with the default install of raven server on my local network.

private static void Main(string[] args)
{
    Stopwatch sw = new Stopwatch();

    using (var documentStore = new DocumentStore() { Url = @"http://hal9013s:8080/", DefaultDatabase = "Qonqr" })
    {
        //This takes away the replication check call but there's still a consistent 21 second pause
        documentStore.Conventions.FailoverBehavior = FailoverBehavior.FailImmediately;

        sw.Start();
        documentStore.Initialize();
        sw.Stop();

        Console.WriteLine("At {0} it took {1} total seconds to initialize", DateTime.UtcNow, sw.Elapsed.TotalSeconds);
    }

    Console.WriteLine("Press Any Key To Exit");
    Console.ReadKey(true);
}

Two sequential runs give the following results:

At 12/1/2013 8:55:15 AM it took 21.2308527 total seconds to initialize 
At 12/1/2013 8:55:55 AM it took 21.2484128 total seconds to initialize

Edit: Changed the client from version 2750 to 2700 as Matt Johnson's comment suggested. Edit 2: Added example code

Bryan Anderson
  • 15,969
  • 8
  • 68
  • 83
  • It shouldn't take that long, but also it's not usually recommended to mismatch client/server versions. Usually they are compatible, but there have been some things in the past where that was an issue. Can you check to see if the problem persists with either Server 2750 or Client 2700? – Matt Johnson-Pint Nov 30 '13 at 20:41

1 Answers1

-1

The usual reason that this call would take a while is if it need to load the database. You can disable the check using FailoverBehavior = FailImmediately, but note that this just means that the next real call would be the one that would load the db.

Ayende Rahien
  • 22,925
  • 1
  • 36
  • 41
  • The database is already loaded, or at least I can view it in the management studio prior to running the application or run the application twice in quick succession and still have the same issue. – Bryan Anderson Dec 01 '13 at 08:45
  • Here are two runs back to back with the example code I added to the question. At 12/1/2013 8:55:15 AM it took 21.2308527 total seconds to initialize At 12/1/2013 8:55:55 AM it took 21.2484128 total seconds to initialize – Bryan Anderson Dec 01 '13 at 08:53
  • I guess the next question is "How do I get the database to stay loaded?" The server is set up based on RavenDB 2.x: Beginner's Guide by Khaled Tannir as an IIS Application. Changing the application pool's Start Mode to Always Running and Auto Start to True just now dropped the `Initialize()` time to 0.17s. I turned the settings off and on again to see which fixed the issue and now I'm back to 21s and can't get the times to drop again. The server is under no memory or CPU pressure, the database is currently 11 documents with 5 basic fields each. – Bryan Anderson Dec 01 '13 at 10:01