I have trouble with HAproxy.
using HAproxy for load balance and backend have 3 squid proxy. But the time
to load a web page with haproxy in front of squid is much more slower than
using squid directly.
this is my conf
global
chroot /loadbalance/haproxy
log 127.0.0.1 local0
maxconn 9000
daemon
# nbproc 4
defaults
log 127.0.0.1 local0 info
# option dontlog-normal
# option splice-auto
option httplog
# option httpclose
option http-server-close
option forwardfor
mode http
clitimeout 4000
contimeout 5000
srvtimeout 6000
retries 2
# acl ads url_dom vcmedia
# block if ads
# Define the user authenticate to view the status of haproxy
# stats enable
# stats auth user:admin
# stats uri /user?stats
# stats user if TRUE
# option transparent
# hash-type consistent
frontend http-sv
# bind :8080 #,:443,:25
# shut the new conn if the client has already ge 10 conn
# tcp-request connection reject if { src_conn_cur ge 10 }
# tcp-request connection track-sc1 src
# acl too_fast be_sess_rate gt 30
# acl too_many be_conn gt 30
# tcp-request content reject if too_fast or too_many
# blocking quang cao
# acl ads url_sub admicro
# acl ads url_sub fbcdn-photos-a
# acl ads url_sub google-analytics
# block if ads
bind :8080
# acl sv_proxy src 10.200.0.0/16
# acl sv_proxy src 5.0.0.0/8
# bind 172.16.1.205:8080
# bind 172.16.1.204:8080
# bind 112.137.132.9:8080
# use_backend server_sv if sv_proxy
default_backend server_sv
# rate-limit sessions 200
# option forwardfor header X-Client
# monitor-net 113.190.222.173/31
backend server_sv
#insert cookie
# cookie S prefix
stats enable
stats auth admin:admin
stats uri /admin?stats
stats admin if TRUE
# rate-limit sessions 200
# option forwardfor header X-Client
# option allbackups
fullconn 2000
server squid1 172.16.1.54:8080 weight 20 maxconn 1000 check inter
20000ms
server squid2 172.16.1.55:8080 weight 20 maxconn 1000 check inter
20000ms
server squid3 172.16.1.204:8081 weight 10 maxconn 300 check inter
20000ms
#source of client
# server backup 127.0.0.1:80 backup source 0.0.0.0
balance source #transparent
# balance roundrobin
# balance uri # transparent
and more problem is that HAproxy alway use more cpu than expect: ~50% in
[root@localhost ~]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Xeon(TM) CPU 3.60GHz
stepping : 10
cpu MHz : 2800.000
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov
pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe lm constant_tsc
pni monitor ds_cpl est tm2 cid cx16 xtpr lahf_lm
bogomips : 7200.79
I dont know how I can tune the system up?
--
Lê Trí Thái
University of Engineering and Technology
Vietnam National University, Hanoi