开发者

Amazon SimpleDB high latency on first request

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.


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


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.


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).


.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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜