I noticed bad network performance on all of my ESP projects. In particular, when I send a sequence of small packets, the first is slow (delivered in ~100 ms) and all the subsequent are fast (~2 ms). Until the packets are sent at a high rate (> 1 per second) they are delivered quickly, but if I send them "occasionally" there is this bad latency.
Initially I thought it was related to the TCP Nagle algorithm, so I tried with ping (ICMP).
If I ping the ESP from a PC, also in this case the delay depends on the ping rate.
Ping rate: 10 per second
for i in $(seq 1 100); do ping -c 1 192.168.1.141 | grep icmp | cut -d' ' -f7; sleep .1; done
Ping rate: 1 every 3 seconds
for i in $(seq 1 100); do ping -c 1 192.168.1.141 | grep icmp | cut -d' ' -f7; sleep 3; done
Then I tried several projects, including one that only consist on connecting to my Wi-Fi AP. I tried almost all versions of SDK, NON_OS_SDK and esp-open-sdk, always with same results. I also tested it with other Wi-Fi APs.
And now the strangest part: I replaced my firmware with the AT Firmware binary (compiled by Espressif) and the ping is always fast (1-2 ms)!
What am I doing wrong? Can you tell me if you have this latency too?