K64,MQX4.02 在对自带的网口做网络压力时,加到5%的网络负荷,就已经ping不通了?请问如何解决呢?
Hi zida:
网络throughput 和系统内存有关系。
在保证系统内存充足的前提下可以尝试修改以下配置 会提高系统网络性能
1 Change the PCB, MSGs and socket number according to your application requirements before calling RTCS_create().
_RTCSPCB_init = 4; _RTCSPCB_grow = 2; _RTCSPCB_max = 20; _RTCS_msgpool_init = 4; _RTCS_msgpool_grow = 2; _RTCS_msgpool_max = 20; _RTCS_socket_part_init = 4; _RTCS_socket_part_grow = 2; _RTCS_socket_part_max = 20;
2 。
You can also modify your sockets buffers size. With TAD you can also check TCP socket connection memory usage. You can call setsockopt() to reduce OPT_TBSIZE and OPT_RBSIZE and the memory usage to open a new TCP socket will be reduced. E.g. uint_32 value; … value = 1024; setsockopt(sock, SOL_TCP,OPT_TBSIZE,&value,sizeof(value)); setsockopt(sock, SOL_TCP,OPT_RBSIZE,&value,sizeof(value));
3
You can use function setsockopt() to manage sockets timeouts. These timeouts are declared in tcp_prv.h on RTCS project. #define TCP_MSL 120000L /* Maximum Segment Lifetime; the longest time that a packet can travel in the Internet (2 min) */ #define TCP_WAITTIMEOUT (2 * TCP_MSL) /* timeout for TIME_WAIT state, defined as 2 * MSL (4 min) */ #define TCP_SENDTIMEOUT_MIN 100000L /* as per RFC1122 4.2.3.5 */ #define TCP_OPENTIMEOUT_MIN 180000L /* as per RFC1122 4.2.3.5 */ But you can override these values with setsockopt().
Please also check this document for reference
https://community.nxp.com/docs/DOC-102077
Hope it helps
Regards
Daniel