Difference between revisions of "Haproxy hitless reload"

From UVOO Tech Wiki
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
- https://www.haproxy.com/blog/haproxy-process-management/
 +
- https://serverfault.com/questions/1088261/haproxy-apis-reload-config
 +
```
 +
echo "show proc" | socat stdio tcp4-connect:192.168.48.2:1234
 +
echo "reload" | socat stdio tcp4-connect:192.168.48.2:1234
 +
```
 +
 +
## 2.5 multithreading via nbthread
 +
-https://www.haproxy.com/documentation/hapee/latest/management/multi-threading/
 +
 +
Older
 +
 +
https://www.haproxy.com/blog/get-to-know-the-haproxy-process-manager/
 +
https://www.haproxy.com/blog/multithreading-in-haproxy/
 +
```
 +
global
 +
  nbproc 1 # haproxy_1  | [ALERT]    (7) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:10] : nbproc is not supported any more since HAProxy 2.5. Threads will automatically be used on multi-processor machines if available.
 +
  nbthread 6
 +
  cpu-map auto:1/1-4 0-3
 +
```
 +
 +
Show threads with -T option
 +
```
 +
ps -aux
 +
ps -T -p 9
 +
 +
# ps -aux
 +
USER        PID %CPU %MEM    VSZ  RSS TTY      STAT START  TIME COMMAND
 +
root          1  0.2  0.0  2420  596 ?        Ss  16:51  0:00 /bin/sh -c /usr/local/sbin/haproxy -S 0.0.0.0:1234 -W -db -f /usr/local/etc/haproxy/haproxy.cfg
 +
root          7  0.3  0.0  89244 10500 ?        S    16:51  0:00 /usr/local/sbin/haproxy -S 0.0.0.0:1234 -W -db -f /usr/local/etc/haproxy/haproxy.cfg
 +
root          9  0.5  0.1 483484 39624 ?        Sl  16:51  0:00 /usr/local/sbin/haproxy -S 0.0.0.0:1234 -W -db -f /usr/local/etc/haproxy/haproxy.cfg
 +
root          16  0.1  0.0  2420  584 pts/0    Ss  16:51  0:00 sh
 +
root          22  0.0  0.0  6700  2900 pts/0    R+  16:51  0:00 ps -aux
 +
# ps -T -p 9
 +
    PID    SPID TTY          TIME CMD
 +
      9      9 ?        00:00:00 haproxy
 +
      9      10 ?        00:00:00 haproxy
 +
      9      11 ?        00:00:00 haproxy
 +
      9      12 ?        00:00:00 haproxy
 +
      9      13 ?        00:00:00 haproxy
 +
      9      14 ?        00:00:00 haproxy
 +
```
 +
 +
 +
# More
 +
 
https://www.haproxy.com/documentation/hapee/latest/api/runtime-api/overview/
 
https://www.haproxy.com/documentation/hapee/latest/api/runtime-api/overview/
  
Line 7: Line 53:
  
 
https://stackoverflow.com/questions/52725226/docker-compose-entrypoint-using-command-exit-code-as-a-failure-detection-mechani
 
https://stackoverflow.com/questions/52725226/docker-compose-entrypoint-using-command-exit-code-as-a-failure-detection-mechani
 +
 +
 +
https://cdn.haproxy.com/wp-content/uploads/2020/04/20.-Master-CLI_Configuration.png
 +
 +
https://www.haproxy.com/blog/truly-seamless-reloads-with-haproxy-no-more-hacks/
 +
 +
https://www.haproxy.org/download/2.6/doc/configuration.txt

Latest revision as of 17:27, 26 July 2022

echo "show proc" | socat stdio tcp4-connect:192.168.48.2:1234
echo "reload" | socat stdio tcp4-connect:192.168.48.2:1234

2.5 multithreading via nbthread

-https://www.haproxy.com/documentation/hapee/latest/management/multi-threading/

Older

https://www.haproxy.com/blog/get-to-know-the-haproxy-process-manager/ https://www.haproxy.com/blog/multithreading-in-haproxy/

global
  nbproc 1 # haproxy_1  | [ALERT]    (7) : config : parsing [/usr/local/etc/haproxy/haproxy.cfg:10] : nbproc is not supported any more since HAProxy 2.5. Threads will automatically be used on multi-processor machines if available.
  nbthread 6
  cpu-map auto:1/1-4 0-3

Show threads with -T option

ps -aux
ps -T -p 9

# ps -aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.2  0.0   2420   596 ?        Ss   16:51   0:00 /bin/sh -c /usr/local/sbin/haproxy -S 0.0.0.0:1234 -W -db -f /usr/local/etc/haproxy/haproxy.cfg
root           7  0.3  0.0  89244 10500 ?        S    16:51   0:00 /usr/local/sbin/haproxy -S 0.0.0.0:1234 -W -db -f /usr/local/etc/haproxy/haproxy.cfg
root           9  0.5  0.1 483484 39624 ?        Sl   16:51   0:00 /usr/local/sbin/haproxy -S 0.0.0.0:1234 -W -db -f /usr/local/etc/haproxy/haproxy.cfg
root          16  0.1  0.0   2420   584 pts/0    Ss   16:51   0:00 sh
root          22  0.0  0.0   6700  2900 pts/0    R+   16:51   0:00 ps -aux
# ps -T -p 9
    PID    SPID TTY          TIME CMD
      9       9 ?        00:00:00 haproxy
      9      10 ?        00:00:00 haproxy
      9      11 ?        00:00:00 haproxy
      9      12 ?        00:00:00 haproxy
      9      13 ?        00:00:00 haproxy
      9      14 ?        00:00:00 haproxy

More

https://www.haproxy.com/documentation/hapee/latest/api/runtime-api/overview/

https://www.haproxy.com/blog/haproxy-process-management/

https://github.com/snorwin/haproxy-reload-wrapper/blob/main/main.go

https://stackoverflow.com/questions/52725226/docker-compose-entrypoint-using-command-exit-code-as-a-failure-detection-mechani

https://cdn.haproxy.com/wp-content/uploads/2020/04/20.-Master-CLI_Configuration.png

https://www.haproxy.com/blog/truly-seamless-reloads-with-haproxy-no-more-hacks/

https://www.haproxy.org/download/2.6/doc/configuration.txt