Yes, its the same for both console db-server and iis db-server. We have tested both on our developer machines and on our staging and our production environment.On Friday, 14 September 2012 11:39:03 UTC+2, Oren Eini wrote:GrrrAnd this is happening on both IIS and console, right?The problem is that this makes no sense as far as I am concerned. I know it isn't buffering, like before, because then we wouldn't have this problem in IIS, it takes care of that, and the size is too small, anyway.
//Asger
Yes, I have mailed wireshark dumps to your mail (it would let me attach them). I could not make it capture the looped back traffic, but I've sent what it looks like when fiddler is enabled (where issue is not present) and when sending in ascii (where issue is not present).The utf8 dump is the one with the issue present.These dumps are made with this program:
class Program{static void Main(string[] args){
const string json =@"{""$id"": ""2"",""$type"": ""Energy10.Core.Domain.Services.Auth.Authentication, Energy10.Core.Domain"",""RememberMe"": true,""DueTime"": ""2012-09-19T13:40:05.4026399"",""UserId"": ""00000000-0000-0000-0000-000000000000"",""Username"": ""a...@version3.dk"",""OnBehalfOfUsername"": null,""OnBehalfOfUserId"": ""00000000-0000-0000-0000-000000000000""}";for (int i = 0; i < 10; i++){var local = (HttpWebRequest)WebRequest.Create("http://localhost:8080/docs/1edfdc9f-6987-4c7e-b259-8f8215f3ec57");local.Credentials = CredentialCache.DefaultNetworkCredentials;var remote = (HttpWebRequest)WebRequest.Create("http://10.10.0.36:8080/docs/1edfdc9f-6987-4c7e-b259-8f8215f3ec57");Execute(local, json);Execute(remote, json);}}static void Execute(HttpWebRequest request, string json){request.Method = "PUT";var enc = Encoding.UTF8;var contentLength = enc.GetByteCount(json) + enc.GetPreamble().Length;request.ContentLength = contentLength;using (var dataStream = request.GetRequestStream())using (var writer = new StreamWriter(dataStream, enc)){writer.Write(json);writer.Flush();dataStream.Flush();}request.GetResponse().Close();}}(note that the earlier tests were made using the DatabaseCommands.Put as stated).//Asger
I hope you got what I sent. Any news on this? Or anything else I can do to help?I have reproduced this against RavenHQ now too, and tried it out connecting from several different machines on different networks. Same problem, though it actually seems to double the wait when https is involved.Response time on a DatabaseCommand.Put are on average this:No fiddler: 530msFiddler with no https decryption: 225msFiddler with https decryption: 105ms//Asger
What’s the size of the documents?
What was the average times before you switched off Nagle?
Could you try setting:
ServicePointManager.Expect100Continue = false;
Note that I don’t know if that’ll have any negative impact on how RavenDb does its negotiation and such, but I doubt it (read: I’m not sure that’s a solution to use in production, but it would be interesting to see if it helps).
I’m looking into how the request is chunked right now, and Fiddler changes this.
//Asger
Yes, I see the same difference with fiddler on and off. If you inspect the network traffic you will see that fiddler changes how the http1.1 chunks are sent on the tcp stream (in less packets).
I am – right now – trying to find out why this is. I will return, when I know more.
Oren, I have tested this in quite a few ways now. And the problem persists.The problem can be split in three seperate issues:1. With Nagle enabled on the client PUTs are slow, and this can be fixed easily by disabling it for servicepoint or directly on http request. As you already know.2. Even with Nagle disabled, Fiddler will make the PUT requests faster. This is due to two thing:a) The Expect100Continue header being sent and requiring additional packets being sent, which is very clear in high latency environment. The solution here could be to disable Expect100 on the request - possibly only for small documents (like request.ServicePoint.Expect100Continue = false)
b) Chunks are smaller when sent directly from the .NET client, than they are when sent through Fiddler. In particular the GZip header is chun ked as a seperate packet, again causing additional traffic that can be seen with high latency. A solution here could be to not chunk small documents, the effect is of course much less evident on larger PUTs.
3. Now the worst part is that we experience the exact same thing when doing GETs now. This is not as consistent - but I have managed to have a 188KB document consitenly take 200ms to load in the studio. In our production environment we see these as sudden spikes (200-800ms) every know and then (more or less every second application request, consisting of roughly 3 GETs and 2 PUTs). It seems that the requests influences each other and randomly waits for ACKs.
We have traced a lot in Wireshark and sometimes it just sends too small chunks causing the Nagle/Delayed ACK behavior again. Unfortunately I was not able to disable Nagle on the server side the same as for the client. And I was not able to influence the chunk size.
Another thing to notice is that the GET problem also exists for larger documents, and I'm not sure if disabling chunking on the response would help or is viable at all.In our test console applications we see these spikes too. Sometimes the requests takes up to 700ms for one GET. Normally it takes 15-20ms.
All these effects are very visible when using e.g. RavenHQ where HTTPS is on.I really don't know what else we can do about this. We use this in production now and we have several daily complaints about the response time. Is it possible to get you to look into this soon?
Please let us know, if there is anything else I can do, traces or test applications we can send you.
FYI I’m working to get some repros to you for tomorrow.
As for Expect100Continue, the only reason to have it turned on – as far as I know – is to prevent users to upload large files only to be given back a “Not Authorized” or another rejection that could have been caught by only sending the headers. I suppose such large uploads could also be used for DOS attacks. My initial reaction is that it does not really apply to the use cases of RavenDB (though of course, I don’t know them all).
Fra: rav...@googlegroups.com [mailto:rav...@googlegroups.com] På vegne af Oren Eini (Ayende Rahien)
Sendt: 1. oktober 2012 16:26
Til: rav...@googlegroups.com
Emne: Re: [RavenDB] Re: Extremely slow put when executed on remote server
inline
//Asger
Fra: rav...@googlegroups.com [mailto:rav...@googlegroups.com] På vegne af Chris Carpenter
Ok. We have now made a repro of the GET-issue. It is not as evident, as we see it in production – I guess that the order and size of the requests matters somehow.
We have setup two virtual machines (running on two separate physical machines), which you can RDP into to see the problem.
Your welcome to use the machines for debugging the issue, if you need to, due to your travelling.
As for Expect100Continue, I too think that’s reasonable to turn off for raven generally.
As for the excessive chunking, I have not made a repro yet, as it is most evident on high latency, and I could not simulate that (without paying money). Still I think the solution is to turn off chunking for small docs. The buffered stream makes no difference, it’s as if the ConnectStream class in .NET sends off chunks by some other “clever” pattern. I have delved into it, but have not found anything yet.
I’ll send you the credentials in a private mail.
//Asger
--
--
You received this message because y