首页 文章

RavenDB服务器模式性能

提问于
浏览
2

我正在尝试从我的RavenDB数据库中获取数据 . 我创建了一个静态索引,并尝试使用推荐的DLL Raven.Client.Lightweight通过我的webservice来执行我的请求 . 此步骤需要3秒钟才能获取数据 .

但是如果我通过RavenDB接口进行相同的查询,我会在10毫秒内得到数据(见更少) .

你知道服务器模式下执行时间慢的原因吗?

谢谢!

编辑:这里有一些代码:我在我的webservice的global.asax中初始化我的文档:

public class Global : System.Web.HttpApplication
{
    public static DocumentStore store;
    protected void Application_Start(object sender, EventArgs e)
    {
        store = new DocumentStore { Url = Settings.Default.Url };
        store.Initialize();
        store.Conventions.AllowQueriesOnId = true;
    }
}

我的请求:公共静态类ServiceBusiness {private static IDocumentSession Session = GetSession(“programs”);

public void MyTestMethod (string MyParamId, string PageNume, string  NbItems)
    {
        List<Content> contents = new List<Content>();
        using (var Session = Global.store.OpenSession("MyDb"))
            {
                contents = Session.Query<Content>("Test")
                                .Where(x => x.Programs.Any(y => y.Products.Any(z => z.Values.Any(w => w.Id == MyParamId))))
                                .Skip((int.Parse(PageNum) - 1) * int.Parse(NbItems))
                                .Take(int.Parse(NbItems))
                                .ToList();
            }
    }
}

1 回答

  • 0

    最后,高响应时间是由于网络中发送的数据包的大小(限制为1514字节) . 我们花了很多时间来组装所有数据包 .

相关问题