Re: [akka-user] [akka-stream] tcp retransmission?

2016-02-29 Thread Val P
Thanks. I am going to write something outside the JDK to test it out. Maybe 
I have a confused IP stack, who knows.



On Monday, February 29, 2016 at 2:21:36 AM UTC-6, drewhk wrote:
>
> Hi Val,
>
> I don't really know what is going on there, Akka works via JDK NIO and 
> have no access to that low level TCP features. In other words, I really 
> don't know what is going on on your machine and why you are seeing it, but 
> I don't think we can do anything about it.
>
> -Endre
>
> On Mon, Feb 29, 2016 at 2:08 AM, Val P  
> wrote:
>
>> I am trying to understand why I'm seeing TCP retransmissions on a simple 
>> program. I created a small program based on the 2.4.2 docs:
>>
>>
>> object HelloWorld {
>>   def main(args: Array[String]): Unit = {
>> implicit val system = ActorSystem("Sys")
>> implicit val materializer = ActorMaterializer()
>>
>> val connections: Source[IncomingConnection, Future[Tcp.ServerBinding]] = 
>>  Tcp().bind("localhost", )
>> connections runForeach { connection =>
>>   // server logic, parses incoming commands
>>   val commandParser = Flow[String].takeWhile(_ != "BYE").map(_ + "!")
>>
>>   import connection._
>>   val welcomeMsg = s"Welcome to: $localAddress, you are: $remoteAddress!"
>>   val welcome = Source.single(welcomeMsg)
>>
>>
>>   val serverLogic = Flow[ByteString]
>> .via(Framing.delimiter( ByteString("\n"),  256 ))
>> .map(_.utf8String)
>> .via(commandParser)
>> // merge in the initial banner after parser
>> .merge(welcome)
>> .map(_ + "\n")
>> .map(ByteString(_))
>>
>>   connection.handleWith(serverLogic)
>> }
>>   }
>>  }
>>
>>
>>
>> But when I connect to localhost/ via telnet, type in a few lines, and 
>> watch the traffic with wireshark, I'm seeing various retransmits and out of 
>> order:
>>
>> 46482→ [SYN] Seq=0 Win=43690 Len=0 MSS=65495 SACK_PERM=1 
>> TSval=47383693 TSecr=0 WS=128 
>> →46482 [SYN, ACK] Seq=0 Ack=1 Win=43690 Len=0 MSS=65495 SACK_PERM=1 
>> TSval=47383693 TSecr=47383693 WS=128 
>> 46482→ [ACK] Seq=1 Ack=1 Win=43776 Len=0 TSval=47383693 TSecr=47383693 
>> →46482 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=56 TSval=47383719 
>> TSecr=47383693 
>> 46482→ [ACK] Seq=1 Ack=57 Win=43776 Len=0 TSval=47383719 
>> TSecr=47383719 
>> [TCP Out-Of-Order] 46482→ [SYN] Seq=0 Win=43690 Len=0 MSS=65495 
>> SACK_PERM=1 TSval=47383693 TSecr=0 WS=128 
>> [TCP Retransmission] →46482 [SYN, ACK] Seq=0 Ack=1 Win=43690 Len=0 
>> MSS=65495 SACK_PERM=1 TSval=47383693 TSecr=47383693 WS=128 
>> 46482→ [ACK] Seq=1 Ack=1 Win=43776 Len=0 TSval=47383693 TSecr=47383693 
>> [TCP Retransmission] →46482 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=56 
>> TSval=47383719 TSecr=47383693 
>> 46482→ [ACK] Seq=1 Ack=57 Win=43776 Len=0 TSval=47383719 
>> TSecr=47383719 
>> 46482→ [PSH, ACK] Seq=1 Ack=57 Win=43776 Len=6 TSval=47384746 
>> TSecr=47383719 
>> →46482 [ACK] Seq=57 Ack=7 Win=43776 Len=0 TSval=47384746 
>> TSecr=47384746 
>> →46482 [PSH, ACK] Seq=57 Ack=7 Win=43776 Len=7 TSval=47384747 
>> TSecr=47384746 
>> 46482→ [ACK] Seq=7 Ack=64 Win=43776 Len=0 TSval=47384747 
>> TSecr=47384747 
>> [TCP Retransmission] 46482→ [PSH, ACK] Seq=1 Ack=57 Win=43776 Len=6 
>> TSval=47384746 TSecr=47383719 
>> →46482 [ACK] Seq=57 Ack=7 Win=43776 Len=0 TSval=47384746 
>> TSecr=47384746 
>> [TCP Retransmission] →46482 [PSH, ACK] Seq=57 Ack=7 Win=43776 Len=7 
>> TSval=47384747 TSecr=47384746 
>> 46482→ [ACK] Seq=7 Ack=64 Win=43776 Len=0 TSval=47384747 
>> TSecr=47384747 
>> 46482→ [PSH, ACK] Seq=7 Ack=64 Win=43776 Len=6 TSval=47386128 
>> TSecr=47384747 
>> →46482 [PSH, ACK] Seq=64 Ack=13 Win=43776 Len=7 TSval=47386129 
>> TSecr=47386128 
>> 46482→ [ACK] Seq=13 Ack=71 Win=43776 Len=0 TSval=47386129 
>> TSecr=47386129 
>> [TCP Retransmission] 46482→ [PSH, ACK] Seq=7 Ack=64 Win=43776 Len=6 
>> TSval=47386128 TSecr=47384747 
>> [TCP Retransmission] →46482 [PSH, ACK] Seq=64 Ack=13 Win=43776 Len=7 
>> TSval=47386129 TSecr=47386128 
>> 46482→ [ACK] Seq=13 Ack=71 Win=43776 Len=0 TSval=47386129 
>> TSecr=47386129 
>>
>> Full trace at http://pastebin.com/09xi1kGa
>>
>> Could someone explain to me if I'm doing something wrong, or what's going 
>> on?
>>
>>
>>
>>
>>
>>
>>
>> -- 
>> >> Read the docs: http://akka.io/docs/
>> >> Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>> >> Search the archives: https://groups.google.com/group/akka-user
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Akka User List" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit 

Re: [akka-user] [akka-stream] tcp retransmission?

2016-02-29 Thread Endre Varga
Hi Val,

I don't really know what is going on there, Akka works via JDK NIO and have
no access to that low level TCP features. In other words, I really don't
know what is going on on your machine and why you are seeing it, but I
don't think we can do anything about it.

-Endre

On Mon, Feb 29, 2016 at 2:08 AM, Val P  wrote:

> I am trying to understand why I'm seeing TCP retransmissions on a simple
> program. I created a small program based on the 2.4.2 docs:
>
>
> object HelloWorld {
>   def main(args: Array[String]): Unit = {
> implicit val system = ActorSystem("Sys")
> implicit val materializer = ActorMaterializer()
>
> val connections: Source[IncomingConnection, Future[Tcp.ServerBinding]] =  
> Tcp().bind("localhost", )
> connections runForeach { connection =>
>   // server logic, parses incoming commands
>   val commandParser = Flow[String].takeWhile(_ != "BYE").map(_ + "!")
>
>   import connection._
>   val welcomeMsg = s"Welcome to: $localAddress, you are: $remoteAddress!"
>   val welcome = Source.single(welcomeMsg)
>
>
>   val serverLogic = Flow[ByteString]
> .via(Framing.delimiter( ByteString("\n"),  256 ))
> .map(_.utf8String)
> .via(commandParser)
> // merge in the initial banner after parser
> .merge(welcome)
> .map(_ + "\n")
> .map(ByteString(_))
>
>   connection.handleWith(serverLogic)
> }
>   }
>  }
>
>
>
> But when I connect to localhost/ via telnet, type in a few lines, and
> watch the traffic with wireshark, I'm seeing various retransmits and out of
> order:
>
> 46482→ [SYN] Seq=0 Win=43690 Len=0 MSS=65495 SACK_PERM=1
> TSval=47383693 TSecr=0 WS=128
> →46482 [SYN, ACK] Seq=0 Ack=1 Win=43690 Len=0 MSS=65495 SACK_PERM=1
> TSval=47383693 TSecr=47383693 WS=128
> 46482→ [ACK] Seq=1 Ack=1 Win=43776 Len=0 TSval=47383693 TSecr=47383693
> →46482 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=56 TSval=47383719
> TSecr=47383693
> 46482→ [ACK] Seq=1 Ack=57 Win=43776 Len=0 TSval=47383719 TSecr=47383719
> [TCP Out-Of-Order] 46482→ [SYN] Seq=0 Win=43690 Len=0 MSS=65495
> SACK_PERM=1 TSval=47383693 TSecr=0 WS=128
> [TCP Retransmission] →46482 [SYN, ACK] Seq=0 Ack=1 Win=43690 Len=0
> MSS=65495 SACK_PERM=1 TSval=47383693 TSecr=47383693 WS=128
> 46482→ [ACK] Seq=1 Ack=1 Win=43776 Len=0 TSval=47383693 TSecr=47383693
> [TCP Retransmission] →46482 [PSH, ACK] Seq=1 Ack=1 Win=43776 Len=56
> TSval=47383719 TSecr=47383693
> 46482→ [ACK] Seq=1 Ack=57 Win=43776 Len=0 TSval=47383719 TSecr=47383719
> 46482→ [PSH, ACK] Seq=1 Ack=57 Win=43776 Len=6 TSval=47384746
> TSecr=47383719
> →46482 [ACK] Seq=57 Ack=7 Win=43776 Len=0 TSval=47384746 TSecr=47384746
> →46482 [PSH, ACK] Seq=57 Ack=7 Win=43776 Len=7 TSval=47384747
> TSecr=47384746
> 46482→ [ACK] Seq=7 Ack=64 Win=43776 Len=0 TSval=47384747 TSecr=47384747
> [TCP Retransmission] 46482→ [PSH, ACK] Seq=1 Ack=57 Win=43776 Len=6
> TSval=47384746 TSecr=47383719
> →46482 [ACK] Seq=57 Ack=7 Win=43776 Len=0 TSval=47384746 TSecr=47384746
> [TCP Retransmission] →46482 [PSH, ACK] Seq=57 Ack=7 Win=43776 Len=7
> TSval=47384747 TSecr=47384746
> 46482→ [ACK] Seq=7 Ack=64 Win=43776 Len=0 TSval=47384747 TSecr=47384747
> 46482→ [PSH, ACK] Seq=7 Ack=64 Win=43776 Len=6 TSval=47386128
> TSecr=47384747
> →46482 [PSH, ACK] Seq=64 Ack=13 Win=43776 Len=7 TSval=47386129
> TSecr=47386128
> 46482→ [ACK] Seq=13 Ack=71 Win=43776 Len=0 TSval=47386129
> TSecr=47386129
> [TCP Retransmission] 46482→ [PSH, ACK] Seq=7 Ack=64 Win=43776 Len=6
> TSval=47386128 TSecr=47384747
> [TCP Retransmission] →46482 [PSH, ACK] Seq=64 Ack=13 Win=43776 Len=7
> TSval=47386129 TSecr=47386128
> 46482→ [ACK] Seq=13 Ack=71 Win=43776 Len=0 TSval=47386129
> TSecr=47386129
>
> Full trace at http://pastebin.com/09xi1kGa
>
> Could someone explain to me if I'm doing something wrong, or what's going
> on?
>
>
>
>
>
>
>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>  Read the docs: http://akka.io/docs/
>>  Check the FAQ: 
>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>  Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group