Best way to throttle FreeRTOS FTP server?

Hi
Has anyone done this / got some suggestions on the best place to throttle the transfer rate on the FTP server- I need to restrict the transfer rate since i have real time, UDP data flying around, lots of it. I dont want the FTP system taking up as much as it can, even with the low priority that it runs at. -
I probably dont need to throttle by speed, just PPS would be enough so putting in a vtaskDelay() in the transfer function somewhere is probably the best means.

  • glen

I have put a vtask delay of 30mS into the read and write loops- the top of the loop.
10mS yielded 315 kbytes/sec RW in/out of RAMdisk (DDR4, 600 MHz cortex A53 Xilinx).
30mS yielded 105 kBytes/sec

I have never had the need to slow down an FTP session, but calling vTaskDelay() sounds like a simple and good solution.

What does it look like on the LAN? Is the FTP data sent in small-enough portions?

“follow” the FTP/TCP session, press: “statistics → TCP stream graphs → tcptrace”, and you will see the load on the LAN.

You might also think of lowering the MSS to avoid bursts from the peer when reading a remote file.

Hi Hein
yes, that’s a good point, I should have a look on wireshark and see what it is doing .
Probably limiting the number of outstanding segments is the best choice, together with the pacing delays.
The effect of the pacing delay I think depends on how many other buffers are elsewhere. A wifi link might behave very differently to a wired link.
I have this right now for config. MSS is about 650 bytes. MTU is 1200.

#define ipconfigFTP_TX_BUFSIZE ( 4 * ipconfigTCP_MSS )
#define ipconfigFTP_TX_WINSIZE ( 2 )
#define ipconfigFTP_RX_BUFSIZE ( 4 * ipconfigTCP_MSS )
#define ipconfigFTP_RX_WINSIZE ( 2 )

#define ipconfigHTTP_TX_BUFSIZE ( 4 * ipconfigTCP_MSS )
#define ipconfigHTTP_TX_WINSIZE ( 2 )
#define ipconfigHTTP_RX_BUFSIZE ( 4 * ipconfigTCP_MSS )
#define ipconfigHTTP_RX_WINSIZE ( 2 )