Any way to increase socket throughput limited by packet size and poll rate? #3232
-
Hi, I am sending files ~3k bytes in size from a Python socket client on a host machine to a mongoose.ws socket server on an embedded device. At some low level, it seems that the file gets split into about 6 packets of ~500 bytes each. My embedded firmware is calling mongoose_poll() 100 times a second so those 6 packets get processed in 6 MG_EV_READ events, with at least 10 milliseconds between events, so the entire file takes at least 50-60 milliseconds to transfer. I am wondering what I can do to speed this up so I can send more files per second. Is there a way to increase packet size, increase the poll rate, or do I need to switch to something like websockets? I tried increasing MG_IO_SIZE and MG_MAX_RECV_SIZE to 16384, but that did not increase the packet size. The Python send buffer size is also 16384. I do not know if the packet size is a fundamental limitation of Ethernet or if it can be changed by the device or the host. I tried polling faster than every 10ms, but that just seemed to create problems without increasing throughput. Can the MG_EV_READ events be interrupt driven rather than limited by the polling rate? I assume the packets are able to transmit much faster than the 10ms polling limitation. Or am I just running into limits of the socket approach and would switching to websockets be better? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Please see our documentation, and follow the guidelines in our tutorials. Please describe your scenario, that "some low level" seems to be TCP MSS and you are talking about sockets. You don't have to call mongoose_poll() 100 times per second, there is no such function, and you have to call mg_mgr_poll() as frequently as possible, not on a timed basis, and behavior depends on your scenario. "embedded device" can have at least 5 different combinations that I remember now. |
Beta Was this translation helpful? Give feedback.
Please see our documentation, and follow the guidelines in our tutorials.
Please describe your scenario, that "some low level" seems to be TCP MSS and you are talking about sockets. You don't have to call mongoose_poll() 100 times per second, there is no such function, and you have to call mg_mgr_poll() as frequently as possible, not on a timed basis, and behavior depends on your scenario. "embedded device" can have at least 5 different combinations that I remember now.
So, please read the tutorials, do things as we do, and if something does not work for you, please correctly describe what you are doing, with what, using what, why, where did you get the idea of doing it that way, etc.