Changing HiLo capacity for web app

Skip to first unread message

Andrew Davey

Dec 7, 2010, 3:07:40 PM12/7/10
to ravendb
My web application requests that store new documents typically only
store a few per session.
I've noticed the default capacity of the HiLo ID generator is 1024 -
resulting in rather large jumps in document IDs.
Does it make sense to change the capacity to something much lower that
meets my needs, like 16, for example?

For those who are interested, this is the code to do this. (Added just
before store.Initialize();)

var generator = new MultiTypeHiLoKeyGenerator(store, 16);
store.Conventions.DocumentKeyGenerator = entity =>
generator.GenerateDocumentKey(store.Conventions, entity);

Ayende Rahien

Dec 7, 2010, 3:50:30 PM12/7/10
to ravendb
The HiLo generator works globally, not on a per session basis.
For production stuff, the server is going to be running a lot, resulting in tight grouping of values.
What you are seeing is probably an issue for development only, when every time that you restarts, it takes a new high.

Andrew Davey

Dec 7, 2010, 4:36:44 PM12/7/10
to ravendb
Thanks for clearing that up for me. I'll leave it set to 1024.
Reply all
Reply to author
0 new messages