重新加载后,旧的 haproxy 进程仍保留在那里,不会释放内存(有时会释放,但行为不一致)。终止旧进程(几天前)后,内存就会释放。
预期行为:我们有长寿命的连接,但这些连接应该在重新加载后从旧进程中最多 4-7 小时后被清除。
ubuntu@ip-10-0-5-193:~$ uname -a
Linux ip-10-0-5-193 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ip-10-0-5-193:~$ haproxy -v
HA-Proxy version 1.5.14 2015/07/02
Copyright 2000-2015 Willy Tarreau <[email protected]>
ubuntu@ip-10-0-5-193:~$ date
Tue Apr 5 00:44:29 UTC 2016
ubuntu@ip-10-0-5-193:~$ ps -ef | grep [h]aproxy
haproxy 7494 1 15 Apr01 ? 13:26:20 /usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -D -sf 30065
haproxy 13357 1 18 Apr04 ? 02:40:15 /usr/local/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /var/run/haproxy.pid -D -sf 7494
ubuntu@ip-10-0-5-193:~$ free -g
total used free shared buffers cached
Mem: 29 26 3 0 0 0
-/+ buffers/cache: 25 4
Swap: 0 0 0
ubuntu@ip-10-0-5-193:~$ sudo kill 7494
ubuntu@ip-10-0-5-193:~$ free -g
total used free shared buffers cached
Mem: 29 10 19 0 0 0
-/+ buffers/cache: 9 20
Swap: 0 0 0
編輯信息:
$ wget http://www.haproxy.org/download/1.5/src/haproxy-1.5.14.tar.gz
$ wget ftp://g.oswego.edu/pub/misc/malloc.c
$ apt-get install -y libssl-dev make libpcre3-dev
$ tar zxvf haproxy-1.5.14.tar.gz; cd haproxy-1.5.14/
$ make TARGET=linux2628 CPU=native USE_STATIC_PCRE=1 ADDLIB=-lz USE_OPENSSL=1 DLMALLOC_SRC=../malloc.c
$ make install
编辑:添加编译时间信息