Search code examples
dockerdocker-swarm

Docker performances for getting information: polling vs events


I have Docker swarm full of containers. I need to monitor when something is up or down. I can do this in 2 ways:

  • attaching to the swarm and listen to events.
  • polling service list

The issue with events is that there might be huge traffic, plus if some event is not processed, we will simply loose information on whats going on.

For me it is not super important to get immediate results, but to have correct information on whats going on.

Any pros/cons from real-life project?


Solution

  • Listening to events- its immediate, but risky as if your event listening program crashes because of any reason, you will miss an important information and lead to wrong result. This Registrator program is based on events. Polling- eventual consistent result. but if it solves your problem it is less painful way to grabbing the data. No matter if your program crashes or restart. We are using this approach for service discovery in our project and so far it served the purpose.