Its great to have load balancing built in, but I have some services that I want to deploy in primary/backup configuration. For example, an instance of ProxySQL is placed in front of the database instances. Currently, I run HAProxy instances (one for each web server instance that connects to a database) with these HAProxy instances configured to proxy all database connections to two ProxySQL instances. The HAProxy config specifies one ProxySQL instance as “primary” and one as “backup” (using the keyword BACKUP in the SERVER line).
I want all database connections to go through the primary ProxySQL instance and only use the backup instance if the primary instance fails (usually because the node it runs on fails for some reason - the nodes are Cloud VMs and they sometimes fail randomly and have to be replaced).
So, my feature request for Docker 1.13 is to add a “backup” designation that can be specified on 1 or more of the tasks in a service and have the load balancing send traffic to the primary tasks and failover to the backup tasks if no primary tasks are currently available to handle the requests.
HAProxy also has a nice feature that you can set the number of healthchecks that fail before a server is marked down and the number of healthchecks that succeed before a downed server is marked as up.
Without the notion of Primary/Backup for tasks, I think I will need to run two services of ProxySQL with each service having 1 task and continue to insert HAProxy instances between the apps and the ProxySQL services. If Docker 1.13 had support for Primary/Backup tasks within a single service, I could get rid of the extra HAProxy instances and use the built in load balancing that swarm mode gives me.