Raven.Server started and binded to port 8022. I initialize DataStore in the following way:
var store = new DocumentStore() { Url = "http://localhost:8022" };
store.Initialize();
Then i'm making such query:
using (var session = store.OpenSession())
{
Stopwatch watch = new Stopwatch();
watch.Start();
var result = session.LuceneQuery<Item>("Raven/DocumentsByEntityName")
.WhereEquals("Tag", "Items")
.ToList();
watch.Stop(); // watch.ElapsedMilliseconds == ~550 ms
return result;
}
And watch.ElapsedMilliseconds
is always ~550 ms.
But when i look to RavenDB console i see that query was processed in 3 ms:
Request # 170: GET - 3 ms - 200 - /indexes/Raven/DocumentsByEntityName?query=Tag%253A%255B%255BItems%255D%255D&start=0&pageSize=128
Thus ~ 99.5% of time have been spent not in RavenDB. What is the problem? (RavenDB 147)
When i switch to self-hosting of RavenDB (i.e. as embedded client) everything is okay (~3ms).
To clarify that issue not in network, http debuggers, dns servers etc. i also tested this:
Stopwatch watch = new Stopwatch();
watch.Start();
WebClient client = new WebClient();
var result = client.DownloadString("http://127.0.0.1:8022/indexes/Raven/DocumentsByEntityName?query=Tag%253A%255B%255BItems%255D%255D&start=0&pageSize=128");
watch.Stop(); // watch.ElapsedMilliseconds == ~3-10ms
Fast. But switching to Raven.Client.Lightweight increase response time in 200 times (550-600 ms)