Ayende @ Rahien

My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:


+972 52-548-6969

, @ Q c

Posts: 6,128 | Comments: 45,551

filter by tags archive

What is making us slow (for the first time, after an idle period)?

time to read 1 min | 187 words

We recently covered this question in several iterations in the ravendb mailing list.

The actual content of the discussion wasn’t so interesting as the number of ways idle time can make you life… interesting. In order to avoid having issues with idle time, you need to:

  • Disable IIS unloading for inactive websites.
  • Disable RavenDB  unloading for inactive databases.
  • Make sure that the HD doesn’t spin down during inactivity.
  • You need to make sure that the system doesn’t got to idle / hibenration.
  • Check that the server hasn’t been paged.
  • Check that the CPU hasn’t moved to low power mode.
  • Check authentication timeouts.

In the end, it was actually the last one that caused the problem. By default, Windows Auth token expire after 15 minutes, so you have to re-authenticate again, and that may make the first query after a while a little slower.

Just for fun, by default, all of the above happen. And that is just when running on a physical machine. When running on VMs (or in the cloud), you need to do all of those checks for the VM and the host machines.


Aleksander Oven

Hi, Oren! This idle delay issue has been bugging me for some time now. I've been eagerly awaiting this post since I first saw it in your queue. But you've left me with a couple of cliffhangers... I hope you don't mind clearing them up for me:

["Disable RavenDB unloading for inactive databases."] I'm not sure I understand what exactly gets unloaded here. Does this apply only to RavenDB's IIS integration, or is there a setting of some sort for when RavenDB is running as an independent Windows service? To be clear, I only really care about the service mode.

["Check that the server hasn’t been paged."] You probably meant to say "Check that the RavenDB process hasn't been paged out to disk by the OS's memory management". There's little that can be done about that from the outside - except having a dummy client poll RavenDB from time to time to keep it active. Doesn't this seem like something that RavenDB could be tought to take care by itself? :)

["Check authentication timeouts."] I have no idea how to do that or what I should do once I determine they're (probably) too short... Simply extending them feels like a global solution to a local problem. Assuming a secure environment, where RavenDB can only be accessed by local processes, is there any way to completely disable these auth checks?


Ayende Rahien

Hi Aleksander, You want to look at this config option: Raven/Tenants/MaxIdleTimeForTenantDatabase See: http://ravendb.net/docs/server/administration/configuration

And we can force our memory to be RAM resident, but that wouldn't play nice with other stuff, and we want to do that.

As for auth timeout, if you are on a secure environment, don't use auth.


I wish all these "interesting" things were documented in one place instead of having to trawl blog posts. On the "How to setup RavenDB" page seems like the logical place.

Lukasz Zwierko

And when working with iSCSI connected HDDs, you might want to watch out for ethernet level packet sized. These guys dont reall work well when typical (1500 bytes or something) value is set.

Ayende Rahien

Frank, They are documented, ravendb.net/docs

Comment preview

Comments have been closed on this topic.


  1. The worker pattern - 4 hours from now

There are posts all the way to May 30, 2016


  1. The design of RavenDB 4.0 (14):
    26 May 2016 - The client side
  2. RavenDB 3.5 whirl wind tour (14):
    25 May 2016 - Got anything to declare, ya smuggler?
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series


Main feed Feed Stats
Comments feed   Comments Feed Stats