Slow speed when using SFTP client through Ha proxy

Hello,

I am experiencing performance issues when downloading files through HAProxy, with download speeds typically ranging between 30-50 Kb/sec. However, when bypassing HAProxy and downloading directly from the SFTP server, I achieve speeds of 30-60 MB/sec.

Configuration Details:

I have two HAProxy instances configured with keepalived for high availability, redirecting traffic to my SFTP servers on port 22.
Additionally, I have configured HTTPS to access the application.
Is there a way to optimize the configuration to increase the download speed?

Configuration File:

For security reasons, I have replaced my IP addresses with “IP”.

global
log 127.0.0.1 local0
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
defaults
mode tcp
log global
option redispatch
retries 3

timeout http-request 10s

timeout queue 1m

 timeout connect        3600s
 timeout client         3600s
 timeout server         3600s
 timeout http-keep-alive   10s

timeout check 10s

frontend my_app_be
bind IP:22
mode tcp
default_backend my_app_be

frontend https
bind IP:443
default_backend https

frontend smtp
bind IP:25
mode tcp
default_backend smtp

backend my_app_be
balance source
server node1 IP.132:22
server node2 IP.131:22

backend https
balance source
server node3 IP:443
server node4 IP:443

backend smtp
balance source
server node9 IP:25 check
server node10 IP:25 check

It’s very unlikely that this has something to do with haproxy itself, you need to benchmark your network.

Try downloading via SFTP from the haproxy instance, but without going trough haproxy from your backend servers, perhaps to /dev/null, to measure SFTP speed from your backend servers to the haproxy instance.

Try a similar tests for the frontend traffic.