High Availability Support (Dev)
Description
This module provides high availability support when multiple instances of the controller are run. It is used to publish and subscribe to updates from multiple controllers, and uses ISyncService in order to store the data. It synchronizes state between the controllers by letting all of them access updates published by all other modules in the controller in an efficient manner. In addition, it runs a leader election process, in order to enable modules to perform role based programming in a distributed system with multiple controllers running and to be able to communicate with each other. The main purpose of this module was to lay the foundation to be able to build a fault tolerant system which is able to then retrieve the state of a failed controller and reinstantiate it to that state.
Services Provided
IHAControllerService
IHAWorkerService
Service Dependencies
IFloodlightService
ILinkDiscoveryService
IFloodlightProviderService
ISyncService
ITopologyService
Java File
net.floodlightcontroller.hasupport
How it works
HAController: This is the IFloodlight module that calls the AsyncElection and ControllerLogic threads, which are used to get the network-wide leader.
AsyncElection: Contains a leader election protocol which elects a leader, amongst all active controllers. It uses NetworkNode in order to communicate with other controllers.
ControllerLogic: Used to keep track of the leader obtained from AsyncElection and to initiate the leader election process when there isn’t one. Additionally, it performs some role based functions, currently publishes and subscribes to other controllers’ updates from other modules.
NetworkNode: A connection manager which is used to handle socket objects to maintain communication between all the controllers. Has a failure detector to determine which controllers are currently active.
HAServer: A server which responds to messages sent by NetworkNode, which is used by AsyncElection.
HAWorker: The HAWorker classes have a publishHook and subscribeHook which enable other controllers to access the updates of this controller. The updates are assembled into a JSON and this class feeds the filter queue. This mechanism is managed by the HAController.
FilterQueue: A LinkedBlockingQueue which ensures that no duplicate updates are pushed into the syncDB when a stream of updates are being published. This class feeds the SyncAdapter.
SyncAdapter: The updates from the other modules contain data which is relational in nature, therefore we perform JSON relational mapping before pushing the updates into the syncDB. This class contains methods to push and pull the updates from the syncDB.
Limitations
Non-majority case: In case 51% of the configured controllers wont connect, controller 1 is set to be the leader by default, however, the other nodes DO NOT follow controller 1. This is just default behavior in order for the controllers to be able to function without the actual need for a leader.
Device manager worker needs to be added.
Scalability: Limited. The module should be extended such that we can scale hierarchically or by some other means.
Configuration
A video explaining how to use this module:
https://www.youtube.com/watch?v=J1AELkF5Yu8
Configuration Options
Nodeid: The controller ID of the current controller. (net.floodlightcontroller.hasupport.HAController.nodeid)
Port: A unique <IP:port> for client side communication of this controller. This is the address which other controllers can use to send/receives messages to this controller. (net.floodlightcontroller.hasupport.HAController.serverPort)
Note: The port must be mentioned in server.config, a file that is placed under src/main/resources, which holds the <IP:port> of all the configured controllers.