Hello,

One of the early requests we got for improving Slider was to have a
way of *ensuring
only a single process* of the given application runs on any given node. I
have read about the ANTI-AFFINITY flag but was not fully sure about its
implementation.

Hence have been  trying to piece things together based on the comments in:

- SLIDER-82
- Steve's blog at
http://steveloughran.blogspot.co.uk/2015/05/dynamic-datacentre-applications.html
- The Slider wiki at -
http://slider.incubator.apache.org/design/rolehistory.html
- Looking at the code

Today the flag PlacementPolicy.ANTI_AFFINITY_REQUIRED seems like a place
holder and is not being used currently  in the flow.

Also, as I understand, the main method where the check on containers happen
is in the Event Handler:

*AppState.onContainersAllocated()*

Since this method makes the decision on the allocated containers before
launching the role, I was thinking of a simple approach where we could :

1) check for the RoleStatus.isAntiAffinePlacement() to be true
2) check if the NodeInstance on which the current container is allocated to
be either  in the RoleHistory.listActiveNodes(roleId) or found to be
unreliable
3) discard the container without decrementing the request count for the role
4) if the container check does not meet the check in #2 then proceed with
the flow
and continue with the launch

The launching of the role via the launchService happens after this check,
so I would hope these checks may not be that expensive.

One other potential area for such a check is
RoleHostory.findNodeForNewInstance(role) during
the iteration of the list of Node Instances from the getNodesForRoleId(),
but based on my  experiments the listofActiveNodes() and the
getNodesForRoleId() seemed mutually exclusive, hence this check may not be
needed there.

Again, not sure if the above can address the different scenarios that is
expected from the ANTI-AFFINITY flag, but was wondering if this was
feasible as a first approach to having some ANTI-AFFINITY support.

Thoughts/Comments are welcome.

Regards,
Rajesh

Reply via email to