Howdy - we use large map files for a variety of purposes, and they change regularly throughout the day.
We currently do a zero-downtime restart on a loop every X seconds to pick up the changes, which means a delay between map file changes and haproxy using them. It also means a spike in memory, which isn’t a dealbreaker.
I’d like to reflect the map changes more quickly. Our map files have 100k+ entries, and many change occur throughout the day. Is there a way to efficiently switch/replace/reload map file contents using the socket commands?
I’m playing with show mapprepare mapset map etc, but with the sheer volume I’m hoping for a bulk mechanism. Maybe continual restarts are still the best way, but it feels like the socket commands are really close to what we need.
Prepare map + set map (with the revision id) + commit map (rev id) would be the way to go for updating multiple entries at once and reducing the lock window to the bare minimum.
With prepare map you get a revision id which can be used to temporary build a new map revision alongside the running one, then you get to populate it as you wish, and when you’re done with the changes, commit it to replace the live one with the given revision atomically. This is what’s recommended for bulk updates.
Directly updating the live map with set-map is indeed very costly because each set would then lock the table during the update.