tcp socket speed 10Mbps only. How can I speed up?

igotit
Posts: 4
Joined: Thu Jul 21, 2016 1:08 pm

tcp socket speed 10Mbps only. How can I speed up?

Postby igotit » Sun Jan 01, 2017 8:49 am

Hi,
I measured the ESP32's tcp socket communication maximum throughput, the maximum speed I achieved is 10Mbit/sec only.

I hope that ESP32's tcp socket is more faster than 10Mbps.
above 10Mbps available in ESP32? If then, please help how can I speed up.


Testing Environment and testing procedures and codes

ESP32 module A : Wifi Station. 802.11.bgn supporting , TCP Socket Client. 240MHz CPU Clock.
ESP32 module B : WiFi Access Point.802.11.bgn supporting, TCP Socket Server.240MHz CPU Clock.
the photo can seen here : http://cfile24.uf.tistory.com/image/263 ... 598A18B56C
the distance between module A and B : 10cm.
module A is WiFi connected to moulde B and then Socket connecting to module B's Tcp Socket Server,
and then modul A send data continuously to module B.
and then I measured the time interval during 10Mbytes sending complete.
the measured time interval is 8~10sec per 10Mbytes sending complete.

module A's codes of sending data

Code: Select all

	uint8_t data_send[1000];
	while(1){
		rs = write(sock,data_send,1000); // 1kbyte sending.
		if(rs <0){
			printf("Send retv < 0");
		}
		else if(rs == 0){
			printf("Send retv = 0");
		}
		else if(rs>0)
		{
			count_send++;
			if(count_send == 10000){ // 10Mbytes((1kbyte * 10000)) sending 
				global_cnt++;
				printf("Sended bytes = 10 Mbytes, count=%d \n",global_cnt);
				count_send = 0;
				data_send[0] = (uint8_t)global_cnt;
			}
		}
	}

module B's codes of receiving data

Code: Select all

while(1){

   ssize_t sizeRead = read(clientSock, data_read, 1000);
   if(sizeRead < 0)
   {
    printf("error recv: %d %s", sizeRead, strerror(errno));
   }
   else if(sizeRead == 0)
   {
    printf("recv retv = 0");
   }  
   else if(sizeRead > 0)
   {
    accum_readbyte += sizeRead;
    if(accum_readbyte > 10000000) // 10Mbytes
    {
     global_cnt++;
     printf("Data Received 10 Mbytes. count=%d\n",global_cnt);
     accum_readbyte = 0;
    }
   }
  }


sgctronic
Posts: 5
Joined: Thu Jan 19, 2017 9:24 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby sgctronic » Mon Jan 23, 2017 5:30 am

Hi,

interesting results. I'm facing similar problems, but worse, I can get only less than 1 Mbit/s.
My configuration is: only one esp32 module connected to the AP and the computer sending the data to the module (connected to same AP via cable).
Please, could you share all the example code to compare the configuration?

Best regards.

roctwo
Posts: 95
Joined: Mon Nov 28, 2016 3:12 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby roctwo » Thu Mar 09, 2017 8:10 am

sgctronic wrote:Hi,

interesting results. I'm facing similar problems, but worse, I can get only less than 1 Mbit/s.
My configuration is: only one esp32 module connected to the AP and the computer sending the data to the module (connected to same AP via cable).
Please, could you share all the example code to compare the configuration?

Best regards.
I am facing similar problems as well.

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby imtiaz » Tue May 16, 2017 8:12 pm

Hi All,

Any resolution on what speeds we can achieve on the esp32 wifi. I've also only achieved relatively slow speeds via TCP sockets. Anyone tried UDP?

Can we get an answer from espressif please - we intend to stream video which will require at least 20 Mbit/sec


Thanks
Imtiaz

bbx10node
Posts: 11
Joined: Thu Sep 29, 2016 5:25 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby bbx10node » Wed May 17, 2017 1:28 am

Some results from the tcp_perf program included in the IDF running on an Adafruit Huzzah ESP32 STA TCP test. Of course, you may get different results depending on your AP, network congestion on your network, etc.

TCP send from ESP32. 2-3 Mbits/s.

Code: Select all

I (16459) tcp_perf:: start sending...
I (19359) tcp_perf:: tcp send 228246 byte per sec!
I (22359) tcp_perf:: tcp send 221920 byte per sec!
I (25359) tcp_perf:: tcp send 167900 byte per sec!
I (28359) tcp_perf:: tcp send 255013 byte per sec!
I (31359) tcp_perf:: tcp send 210240 byte per sec!
I (34359) tcp_perf:: tcp send 53533 byte per sec!
I (37359) tcp_perf:: tcp send 26766 byte per sec!
I (40359) tcp_perf:: tcp send 275453 byte per sec!
I (43359) tcp_perf:: tcp send 324606 byte per sec!
I (46359) tcp_perf:: tcp send 455520 byte per sec!
TCP receive to ESP32. 9+ Mbits/s.

Code: Select all

I (22562) tcp_perf:: tcp connection established!
I (25562) tcp_perf:: tcp recv 1181140 byte per sec!
I (28562) tcp_perf:: tcp recv 1113006 byte per sec!
I (31562) tcp_perf:: tcp recv 1178706 byte per sec!
I (34562) tcp_perf:: tcp recv 1186980 byte per sec!
I (37562) tcp_perf:: tcp recv 1246840 byte per sec!
I (40562) tcp_perf:: tcp recv 1083833 byte per sec!
Same tests running on a SparkFun ESP32 Thing produce much slower results. I have only one so maybe I got a dud unit.

Code: Select all

I (38643) tcp_perf:: tcp connection established!
I (38743) tcp_perf:: start sending...
I (41643) tcp_perf:: tcp send 2433 byte per sec!
I (44643) tcp_perf:: tcp send 18006 byte per sec!
I (47643) tcp_perf:: tcp send 54993 byte per sec!
I (50643) tcp_perf:: tcp send 38933 byte per sec!
I (53643) tcp_perf:: tcp send 12653 byte per sec!
I (56643) tcp_perf:: tcp send 8760 byte per sec!
I (59643) tcp_perf:: tcp send 25306 byte per sec!
I (62643) tcp_perf:: tcp send 18006 byte per sec!
I (65643) tcp_perf:: tcp send 51586 byte per sec!

Code: Select all

I (12412) tcp_perf:: tcp recv 78840 byte per sec!
I (15412) tcp_perf:: tcp recv 91006 byte per sec!
I (18412) tcp_perf:: tcp recv 132860 byte per sec!
I (21412) tcp_perf:: tcp recv 150866 byte per sec!
I (24412) tcp_perf:: tcp recv 140160 byte per sec!
I (27412) tcp_perf:: tcp recv 140160 byte per sec!
I (30412) tcp_perf:: tcp recv 136266 byte per sec!
I (33412) tcp_perf:: tcp recv 143566 byte per sec!
I (36412) tcp_perf:: tcp recv 142593 byte per sec!
I (39412) tcp_perf:: tcp recv 141133 byte per sec!
I (42412) tcp_perf:: tcp recv 100648 byte per sec!

temp4eb
Posts: 35
Joined: Tue Jun 06, 2017 8:59 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby temp4eb » Wed Jun 07, 2017 7:26 am

I got the same issue that tcp_perf only 10Mbit/s:
I (216403) tcp_perf:: tcp send 116313 byte per sec!
I (216403) tcp_perf:: tcp send packet total:18465 succeed:18464 failed:0
time(ms):0-30:17758 30-100:115 100-300:374 300-1000:217 1000+:0

I (219403) tcp_perf:: tcp send 107553 byte per sec!
I (219403) tcp_perf:: tcp send packet total:18686 succeed:18685 failed:0
time(ms):0-30:17973 30-100:116 100-300:375 300-1000:221 1000+:0

I (222403) tcp_perf:: tcp send 115826 byte per sec!
I (222403) tcp_perf:: tcp send packet total:18924 succeed:18923 failed:0
time(ms):0-30:18202 30-100:118 100-300:376 300-1000:227 1000+:0

I (225403) tcp_perf:: tcp send 127506 byte per sec!
I (225403) tcp_perf:: tcp send packet total:19186 succeed:19185 failed:0
time(ms):0-30:18456 30-100:121 100-300:376 300-1000:232 1000+:0

I (228403) tcp_perf:: tcp send 128480 byte per sec!
I (228403) tcp_perf:: tcp send packet total:19450 succeed:19449 failed:0
time(ms):0-30:18711 30-100:124 100-300:377 300-1000:237 1000+:0

I (231403) tcp_perf:: tcp send 128480 byte per sec!
I (231403) tcp_perf:: tcp send packet total:19714 succeed:19713 failed:0
time(ms):0-30:18965 30-100:128 100-300:377 300-1000:243 1000+:0

I (234403) tcp_perf:: tcp send 128480 byte per sec!
I (234403) tcp_perf:: tcp send packet total:19978 succeed:19977 failed:0
time(ms):0-30:19220 30-100:131 100-300:377 300-1000:249 1000+:0

I (237403) tcp_perf:: tcp send 128480 byte per sec!
I (237403) tcp_perf:: tcp send packet total:20242 succeed:20241 failed:0
time(ms):0-30:19476 30-100:133 100-300:377 300-1000:255 1000+:0

I (240403) tcp_perf:: tcp send 128480 byte per sec!
I (240403) tcp_perf:: tcp send packet total:20506 succeed:20505 failed:0
time(ms):0-30:19731 30-100:136 100-300:377 300-1000:261 1000+:0

I (243403) tcp_perf:: tcp send 128480 byte per sec!
I (243403) tcp_perf:: tcp send packet total:20770 succeed:20769 failed:0
time(ms):0-30:19986 30-100:139 100-300:377 300-1000:267 1000+:0

I (246403) tcp_perf:: tcp send 128480 byte per sec!
I (246403) tcp_perf:: tcp send packet total:21034 succeed:21033 failed:0

The test platform is ESP32-DevKitC.Anyone has any suggestion?

temp4eb
Posts: 35
Joined: Tue Jun 06, 2017 8:59 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby temp4eb » Wed Jun 07, 2017 11:31 am

Better now:

I (27462) tcp_perf:: tcp send 352346 byte per sec!
I (30462) tcp_perf:: tcp send 304653 byte per sec!
I (33462) tcp_perf:: tcp send 316333 byte per sec!
I (36462) tcp_perf:: tcp send 301733 byte per sec!
I (39462) tcp_perf:: tcp send 297840 byte per sec!
I (42462) tcp_perf:: tcp send 321200 byte per sec!
I (45462) tcp_perf:: tcp send 299786 byte per sec!
I (48462) tcp_perf:: tcp send 299786 byte per sec!
I (51462) tcp_perf:: tcp send 300273 byte per sec!

rcosta
Posts: 3
Joined: Sun Jun 11, 2017 4:33 pm

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby rcosta » Sun Jun 11, 2017 5:44 pm

Hello dear,

I would like to see as you code work. It's possible to have your complete code?

Thanks in advance.

Best regards,

Regivaldo Costa
--

avoigtl
Posts: 1
Joined: Wed Jun 14, 2017 5:44 pm

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby avoigtl » Wed Jun 14, 2017 5:56 pm

Hello,
I am a beginner on esp32 with expirience on other architectures.
I would confirm that the achievable bandwith is below the expectations.
Below is a copy and past from server example on esp32 working as AccessPoint.
PC transmission is not the gate. LWIP implementation seem to be a code handover without architecture optimization.
Woule be interesting to know which values Espressif can achieve?
Tooling: they made a good job!
Performance: under expecatation!
Current consumption: for net 8Mbit/s too high
Errata: Puuhh, a lot of things are not working and the workarounds are more like decommitments, do not use or unpredictable result

I (5474573) tcp_perf:: station:e8:b1:fc:5e:c0:27 join,AID=1
I (5526386) tcp_perf:: tcp connection established!
I (5529387) tcp_perf:: tcp recv 594706 byte per sec!
I (5532387) tcp_perf:: tcp recv 597140 byte per sec!
I (5535388) tcp_perf:: tcp recv 495426 byte per sec!
I (5538389) tcp_perf:: tcp recv 590326 byte per sec!
I (5541389) tcp_perf:: tcp recv 600546 byte per sec!
I (5544391) tcp_perf:: tcp recv 585460 byte per sec!
I (5547391) tcp_perf:: tcp recv 601033 byte per sec!
I (5550393) tcp_perf:: tcp recv 595680 byte per sec!
I (5553393) tcp_perf:: tcp recv 592273 byte per sec!
I (5556394) tcp_perf:: tcp recv 597140 byte per sec!
I (5559396) tcp_perf:: tcp recv 601033 byte per sec!
I (5562397) tcp_perf:: tcp recv 602980 byte per sec!
I (5565398) tcp_perf:: tcp recv 601033 byte per sec!
I (5568400) tcp_perf:: tcp recv 601033 byte per sec!

temp4eb
Posts: 35
Joined: Tue Jun 06, 2017 8:59 am

Re: tcp socket speed 10Mbps only. How can I speed up?

Postby temp4eb » Thu Jun 15, 2017 5:21 am

rcosta wrote:Hello dear,

I would like to see as you code work. It's possible to have your complete code?

Thanks in advance.

Best regards,

Regivaldo Costa
--
Hi rcosta, I just used the offical example 'tcp_perf' in ESP-IDF SDK.Thanx!

Who is online

Users browsing this forum: No registered users and 99 guests