简体   繁体   English

嵌入式RavenDB与Raven.Server

[英]Emmbedded RavenDB vs. Raven.Server

I made an application where I would query a database with RavenDB. 我制作了一个应用程序,可以在其中使用RavenDB查询数据库。 I use it only on my local machine so I want to change from Raven.Server to Embedded client. 我仅在本地计算机上使用它,因此我想从Raven.Server更改为Embedded Client。 But I noticed my query time I so high when using embedded client. 但是我注意到使用嵌入式客户端时查询时间非常长。

private static EmbeddableDocumentStore documentStore { get; 私有静态EmbeddableDocumentStore documentStore {get; set; 组; } }

    public static void Connect()
    {
        documentStore = new EmbeddableDocumentStore() {/* Url = "http://" + Properties.Settings.Default.DatabaseHost + ":" + Properties.Settings.Default.DatabasePort */ DataDirectory = "Data"};
        documentStore.Initialize();
        IndexCreation.CreateIndexes(typeof(eBayItemIndexer).Assembly, documentStore);
        IndexCreation.CreateIndexes(typeof(RemoveIndexer).Assembly, documentStore);
    }

This is for connection the to the DB. 这是用于连接到数据库。 And here is how I exectute my query: 这是我执行查询的方式:

session.Advanced.DocumentStore.DatabaseCommands.Query("eBayItemIndexer", new Raven.Abstractions.Data.IndexQuery() { Query = RawQuery }, new string[] { "Id" });

Now if I use the EmbeddedDocumentStore my query time is: ~300 ms. 现在,如果我使用EmbeddedDocumentStore,则查询时间为:〜300毫秒。 If I use DocumentStore and connect to the local server my query time is: 4 - 10 ms. 如果我使用DocumentStore并连接到本地服务器,则查询时间为:4-10毫秒。

I would think embedded client is faster? 我会认为嵌入式客户端更快? Am I doing something wrong because a query time of 300ms is way to high. 我做错什么了吗,因为300ms的查询时间太长了。

Probably you aren't getting the benefit from having the server manage everything for you. 让服务器为您管理所有内容可能不会带来任何好处。 In particular, you have to re-create the index if it is a temp index. 特别是,如果它是临时索引,则必须重新创建索引。

好吧,对我来说,这似乎只是在Visual Studio中调试时的一个问题,但是如果我从.exe运行程序,查询时间就可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM