Ethernet webserver poor performance

herhor67
Posts: 6
Joined: Wed Oct 26, 2022 7:56 pm

Ethernet webserver poor performance

Postby herhor67 » Tue Jul 18, 2023 6:23 pm

I am trying the HTTP Webserver example.
I have used a LAN8720 module for wired Ethernet connection with "RMII clock from internal" on GPIO17.
No matter what I set in the SDK Configuration: RTOS settings, size and number of buffers, core affinity for webserver/TCPIP/... tasks, etc. I can't get past a speed of few kB/s.

I made a following change to the get handler for the testing purposes:

Code: Select all

static char randommem[1000];

static esp_err_t get_handler(httpd_req_t *req)
{
	httpd_resp_set_status(req, HTTPD_200);
	httpd_resp_set_type(req, "multipart/mixed; boundary=" BOUNDARY);

	json doc = create_ok_response();
	std::string out = doc.dump();

	httpd_resp_sendstr_chunk(req, "--" BOUNDARY "\r\n");
	httpd_resp_sendstr_chunk(req, "Content-Type: application/json\r\n\r\n");
	httpd_resp_send_chunk(req, out.c_str(), out.length());

	for (int i = 100; i > 0; --i)
	{
		httpd_resp_sendstr_chunk(req, "\r\n--" BOUNDARY "\r\n");
		httpd_resp_sendstr_chunk(req, "Content-Type: application/octet-stream\r\n\r\n");
		httpd_resp_send_chunk(req, randommem, 1000);
	}

	httpd_resp_sendstr_chunk(req, "\r\n--" BOUNDARY "--\r\n");
	httpd_resp_sendstr_chunk(req, nullptr);

	return ESP_OK;
}
The resulting file is ~103kB in size. It takes anywhere from 15 seconds to over a minute (if it doesn't crash mid-way that is, because it really likes to say httpd_txrx: httpd_sock_err: error in send : 128).

Any ideas what am I doing wrong? Is my chip or module faulty?

Who is online

Users browsing this forum: Baidu [Spider] and 199 guests