Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-24 Thread goldsi...@gmx.de
Am 24.09.2021 um 13:28 schrieb Marco Giammarini:
> I enabled lwip_stat and print the data every 10 seconds.
> The result is:
> [..]

You have TCP memerr and HEAP err counters != 0, which indicates you are
running out of memory at some point.

That might be due to parallel HTPP connections but I'm not sure.

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-24 Thread Marco Giammarini
I enabled lwip_stat and print the data every 10 seconds.
The result is:


TCP

xmit: 16742

recv: 12376

fw: 0

drop: 0

chkerr: 0

lenerr: 0

memerr: 300

rterr: 0

proterr: 0

opterr: 0

err: 0

cachehit: 6929


MEM HEAP

avail: 40960

used: 0

max: 39204

err: 322


MEM UDP_PCB

avail: 6

used: 0

max: 0

err: 0


MEM TCP_PCB

avail: 10

used: 10

max: 10

err: 5


MEM TCP_PCB_LISTEN

avail: 3

used: 1

max: 1

err: 0


MEM TCP_SEG

avail: 40

used: 0

max: 19

err: 0


MEM REASSDATA

avail: 5

used: 0

max: 0

err: 0


MEM FRAG_PBUF

avail: 15

used: 0

max: 0

err: 0


MEM SYS_TIMEOUT

avail: 10

used: 6

max: 6

err: 0

I don’t understand why the device doesn’t send the second packet.

Regards,
Marco

> Il giorno 22 set 2021, alle ore 12:03, goldsi...@gmx.de ha scritto:
> 
> Am 22.09.2021 um 11:38 schrieb Marco Giammarini:
>> Dear all,
>> in attach you can find new capture.
>> The lwip device is: 192.168.1.123 for OSX acquisition, and 192.168.10.123 
>> for windows acquisition.
> 
> This clearly looks like a memory/configuration problem in lwIP, as (at
> least in the windows trace), the lwIP device is not sending more than
> one frame without receiving an ACK. And since windows doesn't expect
> this (but wants to send an ACK for every 2nd packet), a timer for
> sending the ACK has to expire in windows. This results in 200ms before
> the ACK is received.
> 
> Normally, the TCP sliding window mechanism should speed things up, but
> that doesn't happen here. You need to find out why by checking
> lwip_stats and/or enable logging in the tcp modules.
> 
> Regards,
> Simon
> 
>> Anyway, if I put the OSX device into the same network of Win device, the 
>> result for OSX device is the same (3/4 seconds to obtain the webpage).
>> 
>> Regards,
>> Marco
>> 
>> 
>> 
>> 
>>> Il giorno 20 set 2021, alle ore 12:30, Marco Giammarini 
>>>  ha scritto:
>>> 
>>> Sorry, you are right. This acquisition are wrong. I’ll capture new ones.
>>> 
>>> Regards,
>>> Marco
>>> 
 Il giorno 20 set 2021, alle ore 12:16, goldsi...@gmx.de ha scritto:
 
 Am 20.09.2021 um 11:54 schrieb goldsi...@gmx.de:
> Am 20.09.2021 um 11:23 schrieb Marco Giammarini:
>> In attach you can find two trace captured with Wireshark. One with 
>> Windows, and one with OSX.
> 
> There are multiple streams in there. Please explain what we're seeing
> and where you think the problem is.
 
 BTW, the config you sent before said "TCP_WND = (3*TCP_MSS)", but in the
 pcaps, the lwIP device (or what I think it is, you didn't tell) sends a
 windows size of 2920 (which is 2 * MSS, not 3 * MSS). Something can't be
 right here.
 
 Regards,
 Simon
 
 ___
 lwip-users mailing list
 lwip-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/lwip-users
>>> 
>> 
>> 
>> ___
>> lwip-users mailing list
>> lwip-users@nongnu.org 
>> https://lists.nongnu.org/mailman/listinfo/lwip-users 
>> 
>> 
> 
> 
> ___
> lwip-users mailing list
> lwip-users@nongnu.org 
> https://lists.nongnu.org/mailman/listinfo/lwip-users 
> 
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-22 Thread goldsi...@gmx.de
Am 22.09.2021 um 11:38 schrieb Marco Giammarini:
> Dear all,
> in attach you can find new capture.
> The lwip device is: 192.168.1.123 for OSX acquisition, and 192.168.10.123 for 
> windows acquisition.

This clearly looks like a memory/configuration problem in lwIP, as (at
least in the windows trace), the lwIP device is not sending more than
one frame without receiving an ACK. And since windows doesn't expect
this (but wants to send an ACK for every 2nd packet), a timer for
sending the ACK has to expire in windows. This results in 200ms before
the ACK is received.

Normally, the TCP sliding window mechanism should speed things up, but
that doesn't happen here. You need to find out why by checking
lwip_stats and/or enable logging in the tcp modules.

Regards,
Simon

> Anyway, if I put the OSX device into the same network of Win device, the 
> result for OSX device is the same (3/4 seconds to obtain the webpage).
>
> Regards,
> Marco
>
>
>
>
>> Il giorno 20 set 2021, alle ore 12:30, Marco Giammarini 
>>  ha scritto:
>>
>> Sorry, you are right. This acquisition are wrong. I’ll capture new ones.
>>
>> Regards,
>> Marco
>>
>>> Il giorno 20 set 2021, alle ore 12:16, goldsi...@gmx.de ha scritto:
>>>
>>> Am 20.09.2021 um 11:54 schrieb goldsi...@gmx.de:
 Am 20.09.2021 um 11:23 schrieb Marco Giammarini:
> In attach you can find two trace captured with Wireshark. One with 
> Windows, and one with OSX.

 There are multiple streams in there. Please explain what we're seeing
 and where you think the problem is.
>>>
>>> BTW, the config you sent before said "TCP_WND = (3*TCP_MSS)", but in the
>>> pcaps, the lwIP device (or what I think it is, you didn't tell) sends a
>>> windows size of 2920 (which is 2 * MSS, not 3 * MSS). Something can't be
>>> right here.
>>>
>>> Regards,
>>> Simon
>>>
>>> ___
>>> lwip-users mailing list
>>> lwip-users@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>
>
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-20 Thread Marco Giammarini
Sorry, you are right. This acquisition are wrong. I’ll capture new ones.

Regards,
Marco

> Il giorno 20 set 2021, alle ore 12:16, goldsi...@gmx.de ha scritto:
> 
> Am 20.09.2021 um 11:54 schrieb goldsi...@gmx.de:
>> Am 20.09.2021 um 11:23 schrieb Marco Giammarini:
>>> In attach you can find two trace captured with Wireshark. One with Windows, 
>>> and one with OSX.
>> 
>> There are multiple streams in there. Please explain what we're seeing
>> and where you think the problem is.
> 
> BTW, the config you sent before said "TCP_WND = (3*TCP_MSS)", but in the
> pcaps, the lwIP device (or what I think it is, you didn't tell) sends a
> windows size of 2920 (which is 2 * MSS, not 3 * MSS). Something can't be
> right here.
> 
> Regards,
> Simon
> 
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-20 Thread goldsi...@gmx.de
Am 20.09.2021 um 11:54 schrieb goldsi...@gmx.de:
> Am 20.09.2021 um 11:23 schrieb Marco Giammarini:
>> In attach you can find two trace captured with Wireshark. One with Windows, 
>> and one with OSX.
>
> There are multiple streams in there. Please explain what we're seeing
> and where you think the problem is.

BTW, the config you sent before said "TCP_WND = (3*TCP_MSS)", but in the
pcaps, the lwIP device (or what I think it is, you didn't tell) sends a
windows size of 2920 (which is 2 * MSS, not 3 * MSS). Something can't be
right here.

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-20 Thread goldsi...@gmx.de
Am 20.09.2021 um 11:23 schrieb Marco Giammarini:
> In attach you can find two trace captured with Wireshark. One with Windows, 
> and one with OSX.

There are multiple streams in there. Please explain what we're seeing
and where you think the problem is.

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-17 Thread goldsi...@gmx.de
Am 17.09.2021 um 10:34 schrieb Tomas Mudrunka:
> Recently there was somebody reporting simillar issue and it turned out
> that some (or most?) browsers use several concurent TCP/HTTP connections
> to load single webpage. Number of these connections was bigger than
> LWIPs default maximum number of concurent TCP connections, so you might
> try to increase that as well...

That's true, but the 10 connections configured below should be enough I
think.

Anyway, if he's reading the pcap and seeing delays due to delayed ACK,
new connections are probably not the problem.

Having access to a trace of this might help, though!

Regeards,
Simon

>
> Tom
>
>
> Dne 2021-09-16 08:49, Marco Giammarini napsal:
>> Dear Simon,
>> Thanks for your reply.
>> I have set 40kB of heap, and every time I stop the microcontroller in
>> debug mode during web site request, the free memory is over 70%.
>> This is my configuration:
>>
>> #DEFINE MEM_SIZE(40*1024)
>>
>> #DEFINE MEMP_NUM_PBUF   28
>>
>> #DEFINE MEMP_NUM_TCP_PCB10
>>
>> #DEFINE MEMP_NUM_TCP_PCB_LISTEN 3
>>
>> #DEFINE MEMP_NUM_TCP_SEG40
>>
>> #DEFINE PBUF_POOL_SIZE  15
>>
>> #DEFINE TCP_MSS (1500 - 40)
>>
>> #DEFINE TCP_SND_BUF (3*TCP_MSS)
>>
>> #DEFINE TCP_SND_QUEUELEN(6 * TCP_SND_BUF)/TCP_MSS
>>
>> #DEFINE TCP_WND (3*TCP_MSS)
>>
>> Is there anything I can change?
>>
>> Regards,
>> Marco
>>
>>> Il giorno 15 set 2021, alle ore 09:55, goldsi...@gmx.de ha scritto:
>>>
>>> Am 15.09.2021 um 08:55 schrieb Marco Giammarini:
>>>
 Dear All,
 I’m studying this problem more in-depth (with Wireshark), and I
 found
 that sometimes Windows reply with ACK after 40ms at every packet.
 In
 this case, with a file of 800kB, a packet of 1460B, we have more
 or less
 500 packets, that multiplied for 40ms reach 20 seconds each file.
 I found that this problem is very common for Windows PC:
 *
 https://developpaper.com/lets-talk-about-the-magical-40-ms-of-tcp/

>>> 
 *

>>>
>> https://docs.microsoft.com/it-it/troubleshoot/windows-server/networking/registry-entry-control-tcp-acknowledgment-behavior

>>>
>> 

 Is there any way to solve the problem (or a workaround) by modify
 some
 parameters of lwIP?
>>>
>>> You should not have a speed problem even if the ACKs get delayed
>>> further. Having a problem here suggests that your lwIP (memory)
>>> options
>>> limit the send window in such amount that transmission stalls until
>>> the
>>> next ACK is received.
>>>
>>> Unless you're really short on memory, you should probably review
>>> your
>>> TCP and memory related options in lwipopts.h
>>>
>>> Regards,
>>> Simon
>>>
>>> ___
>>> lwip-users mailing list
>>> lwip-users@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>> ___
>> lwip-users mailing list
>> lwip-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/lwip-users
>


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-17 Thread Tomas Mudrunka
Recently there was somebody reporting simillar issue and it turned out 
that some (or most?) browsers use several concurent TCP/HTTP connections 
to load single webpage. Number of these connections was bigger than 
LWIPs default maximum number of concurent TCP connections, so you might 
try to increase that as well...


Tom


Dne 2021-09-16 08:49, Marco Giammarini napsal:

Dear Simon,
Thanks for your reply.
I have set 40kB of heap, and every time I stop the microcontroller in
debug mode during web site request, the free memory is over 70%.
This is my configuration:

#DEFINE MEM_SIZE(40*1024)

#DEFINE MEMP_NUM_PBUF   28

#DEFINE MEMP_NUM_TCP_PCB10

#DEFINE MEMP_NUM_TCP_PCB_LISTEN 3

#DEFINE MEMP_NUM_TCP_SEG40

#DEFINE PBUF_POOL_SIZE  15

#DEFINE TCP_MSS (1500 - 40)

#DEFINE TCP_SND_BUF (3*TCP_MSS)

#DEFINE TCP_SND_QUEUELEN(6 * TCP_SND_BUF)/TCP_MSS

#DEFINE TCP_WND (3*TCP_MSS)

Is there anything I can change?

Regards,
Marco


Il giorno 15 set 2021, alle ore 09:55, goldsi...@gmx.de ha scritto:

Am 15.09.2021 um 08:55 schrieb Marco Giammarini:


Dear All,
I’m studying this problem more in-depth (with Wireshark), and I
found
that sometimes Windows reply with ACK after 40ms at every packet.
In
this case, with a file of 800kB, a packet of 1460B, we have more
or less
500 packets, that multiplied for 40ms reach 20 seconds each file.
I found that this problem is very common for Windows PC:
*
https://developpaper.com/lets-talk-about-the-magical-40-ms-of-tcp/




*




https://docs.microsoft.com/it-it/troubleshoot/windows-server/networking/registry-entry-control-tcp-acknowledgment-behavior








Is there any way to solve the problem (or a workaround) by modify
some
parameters of lwIP?


You should not have a speed problem even if the ACKs get delayed
further. Having a problem here suggests that your lwIP (memory)
options
limit the send window in such amount that transmission stalls until
the
next ACK is received.

Unless you're really short on memory, you should probably review
your
TCP and memory related options in lwipopts.h

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


--
S pozdravem
Best regards
 Tomáš Mudruňka - SPOJE.NET s.r.o.

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-15 Thread Marco Giammarini
Dear Simon,
Thanks for your reply.
I have set 40kB of heap, and every time I stop the microcontroller in debug 
mode during web site request, the free memory is over 70%. 
This is my configuration:

#define MEM_SIZE(40*1024) 
#define MEMP_NUM_PBUF   28
#define MEMP_NUM_TCP_PCB10
#define MEMP_NUM_TCP_PCB_LISTEN 3
#define MEMP_NUM_TCP_SEG40
#define PBUF_POOL_SIZE  15
#define TCP_MSS (1500 - 40)
#define TCP_SND_BUF (3*TCP_MSS) 
#define TCP_SND_QUEUELEN(6 * TCP_SND_BUF)/TCP_MSS 
#define TCP_WND (3*TCP_MSS)

Is there anything I can change?

Regards,
Marco


> Il giorno 15 set 2021, alle ore 09:55, goldsi...@gmx.de ha scritto:
> 
> Am 15.09.2021 um 08:55 schrieb Marco Giammarini:
>> Dear All, 
>> I’m studying this problem more in-depth (with Wireshark), and I found
>> that sometimes Windows reply with ACK after 40ms at every packet. In
>> this case, with a file of 800kB, a packet of 1460B, we have more or less
>> 500 packets, that multiplied for 40ms reach 20 seconds each file.
>> I found that this problem is very common for Windows PC:
>> *  https://developpaper.com/lets-talk-about-the-magical-40-ms-of-tcp/
>> 
>> * 
>> https://docs.microsoft.com/it-it/troubleshoot/windows-server/networking/registry-entry-control-tcp-acknowledgment-behavior
>> 
>> 
>> Is there any way to solve the problem (or a workaround) by modify some
>> parameters of lwIP?
> 
> You should not have a speed problem even if the ACKs get delayed
> further. Having a problem here suggests that your lwIP (memory) options
> limit the send window in such amount that transmission stalls until the
> next ACK is received.
> 
> Unless you're really short on memory, you should probably review your
> TCP and memory related options in lwipopts.h
> 
> Regards,
> Simon
> 
> ___
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-15 Thread goldsi...@gmx.de
Am 15.09.2021 um 08:55 schrieb Marco Giammarini:
> Dear All, 
> I’m studying this problem more in-depth (with Wireshark), and I found
> that sometimes Windows reply with ACK after 40ms at every packet. In
> this case, with a file of 800kB, a packet of 1460B, we have more or less
> 500 packets, that multiplied for 40ms reach 20 seconds each file.
> I found that this problem is very common for Windows PC:
> *  https://developpaper.com/lets-talk-about-the-magical-40-ms-of-tcp/
> 
> * 
> https://docs.microsoft.com/it-it/troubleshoot/windows-server/networking/registry-entry-control-tcp-acknowledgment-behavior
> 
>
> Is there any way to solve the problem (or a workaround) by modify some
> parameters of lwIP?

You should not have a speed problem even if the ACKs get delayed
further. Having a problem here suggests that your lwIP (memory) options
limit the send window in such amount that transmission stalls until the
next ACK is received.

Unless you're really short on memory, you should probably review your
TCP and memory related options in lwipopts.h

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] LWIP slow web server only with Windows OS request

2021-09-14 Thread Marco Giammarini
Dear All, 
I’m studying this problem more in-depth (with Wireshark), and I found that 
sometimes Windows reply with ACK after 40ms at every packet. In this case, with 
a file of 800kB, a packet of 1460B, we have more or less 500 packets, that 
multiplied for 40ms reach 20 seconds each file.
I found that this problem is very common for Windows PC:
*  https://developpaper.com/lets-talk-about-the-magical-40-ms-of-tcp/ 

* 
https://docs.microsoft.com/it-it/troubleshoot/windows-server/networking/registry-entry-control-tcp-acknowledgment-behavior
 


Is there any way to solve the problem (or a workaround) by modify some 
parameters of lwIP?

Thanks
Marco___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users