Add juju action to 'drain', so allow existing connections to finish but not accept new

Bug #1876060 reported by Haw Loeung
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Content Cache Charm
Triaged
Wishlist
Unassigned

Bug Description

Hi,

Mostly used for if/when we have some sort of frontend in front of content-cache units (HAProxy in front, Azure LB, etc.). We should have an action to trigger on a unit to drain the queue. So allow existing connections to finish and not accept new.

We'll need to see if HAProxy has a flag to do this and implement it as a juju action.

Revision history for this message
Haw Loeung (hloeung) wrote :

It's possible with 'set server backend/serv state drain' (with 'show servers state' to show the current status). Then 'set server backend/serv state ready' to restore.

e.g.

Current:

| ubuntu@juju-87625f-hloeung-13:~$ echo "show servers state" | sudo -u haproxy socat stdio $(awk '/stats socket/ { print $3 }' /etc/haproxy/haproxy.cfg)
| 1
| # be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port srvrecord
| 7 backend-cached-archive-ubuntu-com 1 server_1 127.0.0.1 2 0 1 1 99487 15 3 6 6 0 0 0 - 6080 -

Drain:

| ubuntu@juju-87625f-hloeung-13:~$ echo "set server backend-cached-archive-ubuntu-com/server_1 state drain" | sudo -u haproxy socat stdio $(awk '/stats socket/ { print $3 }' /etc/haproxy/haproxy.cfg)
| ubuntu@juju-87625f-hloeung-13:~$ echo "show servers state" | sudo -u haproxy socat stdio $(awk '/stats socket/ { print $3 }' /etc/haproxy/haproxy.cfg)
| 1
| # be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port srvrecord
| 7 backend-cached-archive-ubuntu-com 1 server_1 127.0.0.1 2 8 1 1 5 15 3 6 6 0 0 0 - 6080 -
| ...

Restore / undrain:

| ubuntu@juju-87625f-hloeung-13:~$ echo "set server backend-cached-archive-ubuntu-com/server_1 state ready" | sudo -u haproxy socat stdio $(awk '/stats socket/ { print $3 }' /etc/haproxy/haproxy.cfg)
| ubuntu@juju-87625f-hloeung-13:~$ echo "show servers state" | sudo -u haproxy socat stdio $(awk '/stats socket/ { print $3 }' /etc/haproxy/haproxy.cfg)
| 1
| # be_id be_name srv_id srv_name srv_addr srv_op_state srv_admin_state srv_uweight srv_iweight srv_time_since_last_change srv_check_status srv_check_result srv_check_health srv_check_state srv_agent_state bk_f_forced_id srv_f_forced_id srv_fqdn srv_port srvrecord
| 7 backend-cached-archive-ubuntu-com 1 server_1 127.0.0.1 2 0 1 1 71 15 3 6 6 0 0 0 - 6080 -

Haw Loeung (hloeung)
Changed in content-cache-charm:
status: New → Triaged
importance: Undecided → Low
importance: Low → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.