-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ESP8266HTTPClient takes very long time to send 1MB file(SPIFFS) #5679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, this was a annoying issue finally solved by lwIP-v2.1.2 and SACK. Regarding slowness, this will be fixed, I hope, after release 2.5.0, maybe with #5511, |
Hi @d-a-v |
You are already using "higher bandwidth". |
To know whether #5511 will help, there are a couple of experiments to try: If just reading the file takes very long, it's the SPIFFS performance issue. In this case #5511 could help. |
In my experiments it will take about
I stream the exact same file through
It seems no, it's not about file system performance
As I mentioned, the streaming is fast with no delay
So what should we do ?! |
Can you please try actually reading the file? SPIFFS gets slower as it goes further down the file in many cases, and at the end of a 1MB file it may be massively slower than you were getting in the beginning. |
Hi @earlephilhower auto f = SPIFFS.open("/samples.csv", "r");
const auto f_size = f.size();
uint32_t pos = 0;
char buff[2048];
const auto A = millis();
while (pos < f_size && f.available()) {
ESP.wdtFeed();
yield();
f.seek(pos, fs::SeekMode::SeekSet);
const auto read = f.readBytes(buff, sizeof(buff));
pos += read;
}
Serial.printf("\n Took: %lums", millis() - A); |
I think We definitely need an optimized @IMAN4K can you rewrite the above test with a byte by byte transfer and measure its duration ? (I think with a |
@d-a-v |
I'm just curious why in web portal streaming the TCP segment buffer is 1460(1460byte is acknowledged) and in my test 541byte is acknowledged in each transaction?!
|
lwIP bufferizes data until full packets can be sent, because of naggle algorithm and also because peer (the server) allows it. Less and bigger packets, more latency, more throughput. |
Basic Infos
Platform
ESP-12
2.5.0-beta2
other(MSVC2015+VisualMicro)
Windows
Settings in IDE
Generic ESP8266 Module
dio
4MB/3MB
v2 Higher Bandwidth
nodemcu
40Mhz
80Mhz
SERIAL
115200
Problem Description
There's a
.CSV
file in1MB
size that we need to upload toOwnCloud
remote server(i have an average ping of117ms
) which takes about500s
to finish! I'm seeking some optimizations to reduce this time as much as possible(while at the end server return code 500, the file is uploaded correctly!)MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: