0

using the Service correlation affinity scheme I have a stateless health monitoring service (WatchdogService) which pings my Timeservice periodically to check health.

The application manifest defines this correlation between the TimeService and the WatchdogService.

<DefaultServices>
    <Service Name="WatchdogService">
      <StatelessService ServiceTypeName="WatchdogServiceType" InstanceCount="[InstanceCount]">
        <SingletonPartition />
        <ServiceCorrelations>
          <ServiceCorrelation ServiceName="fabric:/TimeServiceApplication/TimeService" Scheme="Affinity" />
        </ServiceCorrelations>
      </StatelessService>
    </Service>
<Service Name="TimeService">
  <StatelessService ServiceTypeName="TimeServiceType" InstanceCount="[InstanceCount]">
    <SingletonPartition />
  </StatelessService>
</Service>
</DefaultServices>

So in the WatchdogService I want to check the health of the service in the same node.

Currently my service is a singleton with an instance count of 1 but if i change this to -1 i want to ensure that the WatchdogService instance on node1 checks the health of the TimeService on node1.

Is there a quick way of finding instances of a service on the same node, and then finding its endpoints?

Below the line with localhost:8088 is where I want to be intelligently using my colocated service as this code won't work with an instance per node. https://github.com/tbertenshaw/FabricAllTheThings/blob/master/src/GuestApplication/WatchdogService/WatchdogService.cs

Tim
  • 7,401
  • 13
  • 61
  • 102

1 Answers1

0
LoekD
  • 11,402
  • 17
  • 27
  • Think I saw that answer before. But my circumstances with a affinity my watchdog service will have one instance of the timeservice in the same node. There doesn't seem to be a simple search without stepping back to the root of the cluster and foreaching till I find my node and the timeservice. Seems a bit longwinded – Tim Sep 13 '17 at 18:36
  • added link to repo where the problem is. The code is modified from an example from mspress fabric book – Tim Sep 13 '17 at 18:44
  • The quickest way would probably be to have the timeservice notify the watchdog about it's health endpoint. Call the watchdog on something like http://localhost/watchdog. May not be what you like.. – LoekD Sep 13 '17 at 18:51
  • Yeah just seems to be a bit of an oversight that there is functionality for fabric to distribute services with affinity but no easyway to discover this. As if you are asking for services to be located close then you surely should be able to find them quickly – Tim Sep 13 '17 at 18:55
  • The whole affinity feature is added to support chatty services being hosted in the cluster, while you modernize them. Location transparency + treating nodes as cattle, not pets, is the intended way to create reliable apps. I'd recommend not using affinity, cache the discovered endpoints and monitor changes to update the cache. – LoekD Sep 13 '17 at 19:12