Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
412 Beiträge
 
#43

AW: schnelle Server Client Verbindung ohne Verluste

  Alt 8. Apr 2025, 08:55
Ich habe im TIdClient und TIdServer jeweils die Property UseNagle auf False gesetzt.
Vor dem Write Aufruf, habe ich UseNagle nochmal abgefragt, ob es wirklich False ist. Ja es ist False.
Ich habe den Write-Aufruf testweise direkt auf WriteDirect geändert.
Trotzdem habe ich das Problem, dass die Write-Aufrufe zwischen 300ms und 1500ms dauern.
Die Daten, welche gesendet werden sollen, stehen in einer Liste und werden über eine While-Schleife abgearbeitet (also innerhalb der While Schleife findet der Write Aufruf statt). Es wird immer der erste Datensatz aus der Liste genommen und die While Schleife läuft bis Count = 0.
Die Telegramme sind zwischen 40 Byte und 25000 Byte lang.
Beispiel: Liste enthält 100 Einträge, es dauert pro Write-Aufruf ~300ms, also dauert die ganze While-Schleife 30s.

Noch eine Idee, mit dem Write-Aufruf?
I am sorry but the translation is hard to follow, by telegram you mean packets, right ? ...anyway

the Nagle should be disabled once per socket, Doesn't need to be adjusted before every call, also it is little more than just disable and forget, make sure both server and client are disabling it, the reason is it is affect packet sending and buffering for packets (buffer) less than MTU (around 1500 bytes) which include the ACK, this ACK will and might delay the traffic, so on both sides,
Nagle by RFC should be 200ms (yet on linux it is 50ms), but it is very hard to witness and measure this exact 200ms, it is possible on Wireshark though, but it is harder form coding on Windows because these modern Windows (definitely since v8) the selective ACK is enabled by default and these two play together, most the time it will be measured from you own code higher than 200ms and less than the double 400ms.

So the suggestion here is: Nagle is not the cause this delay in your program as it can't reach 1500ms, unless the connection is bad and so bad suffering from retransmission, you did not mention how and where you are testing, on loopback (same device) or over network (wireless or wired?) ....

In all cases, i prefer to see code and give it a try and find your bug, please provide a demo causing this.
Kas
  Mit Zitat antworten Zitat