WiFi transfer speed starts out great, then crashes down: can the ESP32's WiFi dynamic rate scaling algorithm be tuned?
Posted: Fri Apr 22, 2022 12:54 am
ESP32-WROVER-32E based data logger is collects data during the day and uploads it via WiFi during the night.
Strangely, the bulk transfer speed starts out great, but reduces greatly after a few minutes (sometimes 1 minute, sometimes 5 minutes, with 2 minutes being typical).
Sample1:
Sample2:
Circumstances:
- The logger and the AP antenna are quite far apart, about 90 metres;
- This is in an open field, direct line of sight, very quiet (radio-wise) environment;
- The RSSI does not change as you can see, it is about -74 dBm
- Same device with the same code achieves more than 10 Mbps when it's closer to the AP
I'm not sure what causes this sudden drop in transfer speed, but it smells of PHY issue, and I suspect it is the WiFi dynamic rate scaling feature (I'm reading here about it). Likely the ESP32 PHY starts out sending packets at higher bitrate, sees some lost packets, adjust speeds and thus we observe 2-4 varying Mbps in the first few minutes. Then it suddenly gives up and fixates on 0.64 Mbps which maybe causes no packet loss.
The other thing that happens is that the ESP32 consumes more power in the 0.64 Mbps mode. Computed roughly by the drop in battery voltage (internal resistance & co) I think the total ESP32 consumption jumps from ~150mA to about ~350mA.
In general it sucks to be stuck in the 0.64 Mbps mode, as it's worse both speed-wise and power-wise. And it doesn't get unstuck by itself: unless the device is physically moved, it almost never ever improves above 0.6-0.8 Mbps. But if you restart it, it begins with the faster speed again, and then similarly crashes after a few minutes.
Question
Is it possible to tune the PHY's dynamic rate scaling algorithms for WiFi? I want to instruct it to prioritize throughput at the cost of higher packet loss and retries. I.e. "please, only reduce the bitrate if the packet loss is awfully bad".
Strangely, the bulk transfer speed starts out great, but reduces greatly after a few minutes (sometimes 1 minute, sometimes 5 minutes, with 2 minutes being typical).
Sample1:
Sample2:
Circumstances:
- The logger and the AP antenna are quite far apart, about 90 metres;
- This is in an open field, direct line of sight, very quiet (radio-wise) environment;
- The RSSI does not change as you can see, it is about -74 dBm
- Same device with the same code achieves more than 10 Mbps when it's closer to the AP
I'm not sure what causes this sudden drop in transfer speed, but it smells of PHY issue, and I suspect it is the WiFi dynamic rate scaling feature (I'm reading here about it). Likely the ESP32 PHY starts out sending packets at higher bitrate, sees some lost packets, adjust speeds and thus we observe 2-4 varying Mbps in the first few minutes. Then it suddenly gives up and fixates on 0.64 Mbps which maybe causes no packet loss.
The other thing that happens is that the ESP32 consumes more power in the 0.64 Mbps mode. Computed roughly by the drop in battery voltage (internal resistance & co) I think the total ESP32 consumption jumps from ~150mA to about ~350mA.
In general it sucks to be stuck in the 0.64 Mbps mode, as it's worse both speed-wise and power-wise. And it doesn't get unstuck by itself: unless the device is physically moved, it almost never ever improves above 0.6-0.8 Mbps. But if you restart it, it begins with the faster speed again, and then similarly crashes after a few minutes.
Question
Is it possible to tune the PHY's dynamic rate scaling algorithms for WiFi? I want to instruct it to prioritize throughput at the cost of higher packet loss and retries. I.e. "please, only reduce the bitrate if the packet loss is awfully bad".