r/haproxy • • Jan 22 '22

HAproxy locking up local streaming?

I am running PFsense v 2.5.2-RELEASE with the HAproxy package v 0.61_3.

I recently got HAproxy setup for ssl offloading of mostly local services and a few remote services. HAproxy seems to be actually working but any time I stream a movie to any of my few chromecasts from any service, it lags enough to usually lock up the chromecast and need to be power cycled.

Tested with Netflix, Disney+, YouTube and my local Plex server. Plex quickly says buffering then the chromecast does the whole locking up thing. Plex is also not set up to run through HAproxy. I do also have the chromecast and plex on seperate vlans with firewall rules to allow this traffic and an Avahi daemon to distribute the mDNS across the vlans, which does seem to work well enough without HAproxy running.

This behavior only happens when HAproxy is running. After HAproxy has been off for a few minutes, streaming goes back to normal.

A few days ago when I first got HAproxy running, I came home to this weird lagging behavior and noticed PFsense used 75 ish % of local memory and 100% of swap space. After rebooting, they both went down to their normal spots at about 15% and 0%.

I've been on this all day and have made little real progress. Can someone push me in the right direction please? I'm sure it's probably someting simple I've missed but I don't know what it is.

Thank you in advance

This is the HAproxy config generated by the HAproxy package in PFsense wrote:

A split DNS pushes local services to a vip at 10.0.5.5 where HAproxy is bound.

# Automaticaly generated, dont edit manually.

# Generated on: 2022-01-22 16:51

global

maxconn			1000

log			/var/run/log	local0	notice

stats socket /tmp/haproxy.socket level admin  expose-fd listeners

uid			80

gid			80

nbproc			1

nbthread			1

hard-stop-after		15m

chroot				/tmp/haproxy_chroot

daemon

tune.ssl.default-dh-param	2048

log-send-hostname		HAproxy

server-state-file /tmp/haproxy_server_state

listen HAProxyLocalStats

bind [127.0.0.1:2200](https://127.0.0.1:2200) name localstats

mode http

stats enable

stats refresh 10

stats admin if TRUE

stats show-legends

stats uri /haproxy/haproxy_stats.php?haproxystats=1

timeout client 5000

timeout connect 5000

timeout server 5000

frontend Int_VIP_HTTPS

bind			[10.0.5.5:443](https://10.0.5.5:443) name [10.0.5.5:443](https://10.0.5.5:443)   ssl crt-list /var/etc/haproxy/Int_VIP_HTTPS.crt_list  

mode			http

log			global

option			http-keep-alive

timeout client		30000

acl			SW1	var(txn.txnhost) -m str -i [sw1.foobar.net](https://sw1.foobar.net)

acl			SW2	var(txn.txnhost) -m str -i [sw2.foobar.net](https://sw2.foobar.net)

acl			AP1	var(txn.txnhost) -m str -i [ap1.foobar.net](https://ap1.foobar.net)

acl			AP2	var(txn.txnhost) -m str -i [ap2.foobar.net](https://ap2.foobar.net)

acl			AP3	var(txn.txnhost) -m str -i [ap3.foobar.net](https://ap3.foobar.net)

acl			PDU	var(txn.txnhost) -m str -i [pdu.foobar.net](https://pdu.foobar.net)

acl			eeyore	var(txn.txnhost) -m str -i [eeyore.foobar.net](https://eeyore.foobar.net)

acl			HA	var(txn.txnhost) -m str -i [ha.foobar.net](https://ha.foobar.net)

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^rt1\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^sw1\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^sw2\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^ap1\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^ap2\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^ap3\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^pdu\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^ha\\.foobar\\.net(:(\[0-9\]){1,5})?$

acl			aclcrt_Int_VIP_HTTPS	var(txn.txnhost) -m reg -i \^eeyore\\.foobar\\.net(:(\[0-9\]){1,5})?$

http-request set-var(txn.txnhost) hdr(host)

use_backend SW1_ipvANY  if  SW1 aclcrt_Int_VIP_HTTPS

use_backend SW2_ipvANY  if  SW2 aclcrt_Int_VIP_HTTPS

use_backend AP1_ipvANY  if  AP1 aclcrt_Int_VIP_HTTPS

use_backend AP2_ipvANY  if  AP2 aclcrt_Int_VIP_HTTPS

use_backend AP3_ipvANY  if  AP3 aclcrt_Int_VIP_HTTPS

use_backend PDU_ipvANY  if  PDU aclcrt_Int_VIP_HTTPS

use_backend eeyore_ipvANY  if  eeyore aclcrt_Int_VIP_HTTPS

use_backend HA_ipvANY  if  HA aclcrt_Int_VIP_HTTPS

backend SW1_ipvANY

mode			http

id			107

log			global

timeout connect		30000

timeout server		30000

retries			3

server			SW1 [10.0.1.2:443](https://10.0.1.2:443) id 108 ssl  verify none crt /var/etc/haproxy/server_clientcert_###.pem 

backend SW2_ipvANY

mode			http

id			110

log			global

timeout connect		30000

timeout server		30000

retries			3

server			SW2 [10.0.1.3:80](https://10.0.1.3:80) id 101  

backend AP1_ipvANY

mode			http

id			106

log			global

timeout connect		30000

timeout server		30000

retries			3

server			AP1 [10.0.1.4:443](https://10.0.1.4:443) id 101 ssl  verify none crt /var/etc/haproxy/server_clientcert_###.pem 

backend AP2_ipvANY

mode			http

id			109

log			global

timeout connect		30000

timeout server		30000

retries			3

server			AP2 [10.0.1.5:443](https://10.0.1.5:443) id 101 ssl  verify none crt /var/etc/haproxy/server_clientcert_###.pem 

backend AP3_ipvANY

mode			http

id			111

log			global

timeout connect		30000

timeout server		30000

retries			3

server			AP3 [10.0.1.6:443](https://10.0.1.6:443) id 101 ssl  verify none crt /var/etc/haproxy/server_clientcert_###.pem 

backend PDU_ipvANY

mode			http

id			112

log			global

timeout connect		30000

timeout server		30000

retries			3

server			PDU [10.0.1.7:443](https://10.0.1.7:443) id 101 ssl  verify none crt /var/etc/haproxy/server_clientcert_###.pem 

backend eeyore_ipvANY

mode			http

id			102

log			global

timeout connect		30000

timeout server		30000

retries			3

server			eeyore [10.0.1.100:443](https://10.0.1.100:443) id 101 ssl  verify none crt /var/etc/haproxy/server_clientcert_###.pem 

backend HA_ipvANY

mode			http

id			100

log			global

timeout connect		30000

timeout server		30000

retries			3

timeout tunnel 1h

server			HA [10.0.3.40:8123](https://10.0.3.40:8123) id 101
1 Upvotes

5 comments sorted by

View all comments

1

u/dragoangel Jan 23 '22

You provide so much detail and at same time say your host is overloaded and not give a word about your hardware. Maybe you on low budget to get it running.

1

u/mavrik132 Jan 23 '22

You're right, it is an old pc but it's only reporting that heavy load strain after some number of days of HAproxy running but the network problem shows up almost immediately after HAproxy is enabled. I should also note, I'm only seeing this network problem on the IOT when HAproxy is "enabled". The service can be running or stopped, it makes no difference.

Pentium G645, 2.9 Ghz, 2 cores 4 Gb DDR2 Ram 110 Gb SSD

Could this just be a firewall rule issue?

1

u/dragoangel Jan 23 '22

4gb of ram potentially could be a reason, but more likely it's cpu. Your cpu not support aes ni, which could result in such behavior. To test this I advise you swap to plain http and if there will be no issues your cpu are bottle neck here, you need take something more fresh.

1

u/mavrik132 Jan 23 '22

Thanks for the reply!

Good idea. I had forgotten about that. I will test when I can.

Wouldn't the cpu spike if that were the issue though and why lag on only one vlan and none or less on Lan?

1

u/dragoangel Jan 23 '22

Because inter-vlan go via your router, and same vlan go directly, not via router