gpt4 book ai didi

c# - RavenDB 服务器模式性能

转载 作者:太空宇宙 更新时间:2023-11-03 15:45:59 28 4
gpt4 key购买 nike

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

但如果我通过 RavenDB 接口(interface)执行相同的查询,我会在 10 毫秒内获得数据(见更少)。

你知道为什么在服务器模式下执行时间很慢吗?

谢谢!

编辑:这里有一些代码:我在我的网络服务的 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;
}
}

我的要求:公共(public)静态类 ServiceBusiness { private static IDocumentSession Session = GetSession("程序");

    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();
}
}
}

最佳答案

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

关于c# - RavenDB 服务器模式性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28112350/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com