Amazon SimpleDB 首次请求时出现高延迟

发布于 2024-10-18 07:18:11 字数 966 浏览 3 评论 0原文

我在桌面应用程序(C#、.NET 2.0)中使用 SimpleDB,并且遇到高延迟问题。
第一次向数据库发出请求(查询、插入值 - 无关紧要)时,我仅在大约 10-20 秒后收到响应。这种情况只发生在第一次,其余的响应都相当快(尚未测量,但肯定低于 300 毫秒)。
当我创建数据库客户端时,这种情况不会发生,只有当我执行第一个请求时,才会发生这种情况。认证这么慢正常吗? (我认为在第一次请求时身份验证已完成)。

提前致谢。

编辑

当我第一次运行类似

SelectResponse response = dbService_.Select(request);

输出面板中的内容时,我得到:

'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded'C:\Windows\assembly\GAC_MSIL\System.Data.SqlXml\2.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll'
'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded 'System.Xml.Xsl.CompiledQuery.1'
'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded 'System.Xml.Xsl.CompiledQuery'
 A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded 'rg1d4wjc'  

这正常吗? FileNotFoundException 看起来很奇怪。

I'm using SimpleDB in a desktop application (C#, .NET 2.0) and have a problem with high latency.
The first time I make a request to the DB (query, insert values - doesn't matter) I get a response only after about 10-20 seconds. This happens only the first time, the rest of the responses are pretty fast (haven't measured, but under 300ms for sure).
This doesn't happen when I create the DB client, only when I do the first request. Is it normal for authentication to be that slow? (I presume that on the first request authentication is done).

Thanks in advance.

EDIT

When I run the first time something like

SelectResponse response = dbService_.Select(request);

in the output panel I get:

'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded'C:\Windows\assembly\GAC_MSIL\System.Data.SqlXml\2.0.0.0__b77a5c561934e089\System.Data.SqlXml.dll'
'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded 'System.Xml.Xsl.CompiledQuery.1'
'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded 'System.Xml.Xsl.CompiledQuery'
 A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'PhotoExchange.vshost.exe' (Managed (v2.0.50727)): Loaded 'rg1d4wjc'  

Is it normal? The FileNotFoundException looks very strange.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

墨落画卷 2024-10-25 07:18:11

听起来好像有些东西超时了,然后默默地故障转移到成功的第二个通道,然后缓存该通道以供后续调用。第一个怀疑? DNS,可能是。我会检查您工作站的 TCP/IP 设置,看看您的主 DNS 服务器是否已启动,或者将其替换为 Google 的公共 DNS,地址为 8.8.8.8 和 8.8.4.4

Sounds like something is timing out, then silently failing over to a successful second channel that is then cached for subsequent calls. First suspicion? DNS, probably. I'd check your workstation's TCP/IP settings to see if your Primary DNS server is up, or replace them with Google's Public DNS at 8.8.8.8 and 8.8.4.4

天气好吗我好吗 2024-10-25 07:18:11

它可能是 WebProxy 检测(我假设您使用的 .NET 客户端只是 Web 服务的包装器)。

查看是否可以禁用/清空服务包装器使用的 WebClient 上的 WebProxy 属性。

It may be WebProxy detection (I assume the .NET client you are using is just a wrapper around a web service).

See if you can disable/null out the WebProxy property on the WebClient being used by the service wrapper.

愿得七秒忆 2024-10-25 07:18:11

据猜测,您正在运行时从 WSDL 动态构建服务客户端 - 尽管我不确定它应该花费那么长时间。

相反,您可以通过在 Visual Studio 中添加 Web 服务引用或使用 svcutil.exe(等效的命令行实用程序)提前将其构建到您的项目中。

At a guess, you're building the service client dynamically from the WSDL at runtime - although I'm not sure it should take that long.

Instead you could build this into your project in advance by adding a web service reference in Visual Studio or using svcutil.exe (the equivalent command-line utility).

你的笑 2024-10-25 07:18:11

.NET 进行即时 (JIT) 编译(在代码编译时编译代码)第一次运行),第一次迭代总会有速度损失(尽管 10-20 秒似乎很大)。

我从未使用过它们,但有像 ngen 这样的工具可以让您预先编译代码。

在我不能允许第一次迭代变慢的应用程序中,我通常通过让“虚拟”数据运行我的关键路径来初始化应用程序。

该问题可能还有其他原因,但我会对此进行调查。

希望这有帮助

.NET does Just in time (JIT) compilation (compiles the code when it is first run), theres always a speed penalty on the first iteration (altough 10-20 seconds seems huge).

I have never used them but there are tools like ngen which allows you to compile the code beforehand.

In applications where I cant allow the first iteration to be slow I usually initialize the application by having "dummy" data run through my critical path.

There are probably other causes for the problem, but I would investigate that.

Hopefully that helps

掩耳倾听 2024-10-25 07:18:11

我的 Windows/.NET 安装可能有问题。
我从 SDK 中获取了一个样本,对其进行了编译(甚至使用了 NGEN),并在第一个请求上得到了大约 30 秒的延迟。我将相同的可执行文件复制到虚拟机,延迟为5 秒。虽然还是蛮大的,不过也可以接受。

Probably there is something wrong with my Windows/.NET installation.
I took a sample from the SDK, compiled it (even used NGEN) and got about 30 sec delay on the first request. I copied the same executable to a virtual machine and the delay was 5 seconds. Still pretty big, but it's acceptable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文