Sling
  1. Sling
  2. SLING-2827

discovery.impl: a resource based implementation of the discovery.api

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Discovery Impl 1.0.0
    • Component/s: Extensions
    • Labels:
      None

      Description

      This ticket is about contributing a resource based implementation of the discovery api (see [0]) named discovery.impl to Sling. The implementation is attached as a .tar.gz - its md5 hash is d8891e5401114b2a629d3ff01044a1d6

      Short description of the discovery.impl:

      The discovery.impl is an out-of-the-box implementation of the discovery.api using standard features of Sling. The discovery.api provides a view of a topology consisting of a number of individual sling-instances. The instances are loosely coupled, except for being part of the topology they do not implicitly or necessarily share anything else. For those instances though that form a cluster - ie when connected to the same repository - the api has an abstraction called ClusterView.

      The discovery.impl uses two mechanisms for discovering other instances:

      • it stores information about the local instance at a unique location in the repository. Thus allowing other instances that access the same repository to see and recognize each other.
      • it connects to 'remote' instances via a plain HTTP POST, announcing the instances that it can see, and getting back the instances of the counterpart

      All of the above is done regularly using a heart-beat - thus allowing to get a view of the currently live instances.

      The discovery.api additionally supports leader-election within a cluster: it ensures that one and only one instance is elected leader and stays leader until it disappears/shuts down/dies. The discovery.impl uses repository-based voting between the instances of a cluster to establish a common 'cluster view'. Based on an established view, the discovery.impl is then able to deterministically elect one of the instances of the view as the leader (namely the one with the lowest 'id').

      Also, to support the PropertyProvider concept of the discovery.api, the properties of each instance are propagated to the other instances using the heartbeat as piggyback (either via the repository or via HTTP POSTs for remote instances).

      To get an idea of the discovery.impl build and add and start the two bundles (org.apache.sling.discovery.api and org.apache.sling.discovery.impl) to your sling installation and open the browser to the provided, simplistic 'topology webconsole' at

      http://localhost:4502/system/console/topology

      Please let me know if anything needs further explanation, details. Looking forward to having this included in Sling!

      Cheers,
      Stefan

      [0] http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/discovery/api

      1. discovery.impl.tar.gz
        47 kB
        Stefan Egli
      2. discovery.impl.svn.patch
        75 kB
        Stefan Egli
      3. discovery.impl.loops.timeouts.webconsole.patch
        52 kB
        Stefan Egli
      4. discovery.impl.bootstrap.patch
        4 kB
        Stefan Egli
      5. discovery.impl.activate_and_changing.patch
        7 kB
        Stefan Egli

        Activity

        Hide
        Stefan Egli added a comment -

        as described this contains the discover.impl bundle - the md5 is d8891e5401114b2a629d3ff01044a1d6

        Show
        Stefan Egli added a comment - as described this contains the discover.impl bundle - the md5 is d8891e5401114b2a629d3ff01044a1d6
        Hide
        Stefan Egli added a comment -

        Patch for fixing a bug with bootstrap in standalone-mode plus initially joining a cluster

        Show
        Stefan Egli added a comment - Patch for fixing a bug with bootstrap in standalone-mode plus initially joining a cluster
        Hide
        Stefan Egli added a comment -

        various fixes and improvements:

        • dont include timedout announcements of other cluster instances
        • support switch from isolated to cluster mode (by filtering properly)
        • improve webconsole to support ping-trigger and better indicate errors (incl tooltip about possible reason)
        • avoid circular dependency with webconsole
        • fix event handling filtering
        • catch rare exception cases
        • support list of whitelisted ips/hostnames (instead of comma separated)
        Show
        Stefan Egli added a comment - various fixes and improvements: dont include timedout announcements of other cluster instances support switch from isolated to cluster mode (by filtering properly) improve webconsole to support ping-trigger and better indicate errors (incl tooltip about possible reason) avoid circular dependency with webconsole fix event handling filtering catch rare exception cases support list of whitelisted ips/hostnames (instead of comma separated)
        Hide
        Carsten Ziegeler added a comment -

        Thanks for your contribution, Stefan - I've applied your first version (md5 d8891e5401114b2a629d3ff01044a1d6). However I wasn't able to apply the patches.
        Could you please create a new patch based on the version from svn?

        Show
        Carsten Ziegeler added a comment - Thanks for your contribution, Stefan - I've applied your first version (md5 d8891e5401114b2a629d3ff01044a1d6). However I wasn't able to apply the patches. Could you please create a new patch based on the version from svn?
        Hide
        Stefan Egli added a comment -

        Carsten Ziegeler Sure, sorry bout that, that might stem from the fact that it was created in git..:S

        Attached the svn-based diff based on r1470424 including the latest rename of DiscoveryAware to TopologyEventListener

        Show
        Stefan Egli added a comment - Carsten Ziegeler Sure, sorry bout that, that might stem from the fact that it was created in git..:S Attached the svn-based diff based on r1470424 including the latest rename of DiscoveryAware to TopologyEventListener
        Hide
        Carsten Ziegeler added a comment -

        Thanks for the updated patch, Stefan - it's applied now.

        Show
        Carsten Ziegeler added a comment - Thanks for the updated patch, Stefan - it's applied now.
        Hide
        Stefan Egli added a comment -

        Carsten Ziegeler another patch based on the current trunk of discovery/impl: it contains a fix for properly sending TOPOLOGY_INIT as the first event for newly bound TopologyEventListeners - plus makes sure a TOPOLOGY_CHANGING is sent before TOPOLOGY_CHANGED.

        Show
        Stefan Egli added a comment - Carsten Ziegeler another patch based on the current trunk of discovery/impl: it contains a fix for properly sending TOPOLOGY_INIT as the first event for newly bound TopologyEventListeners - plus makes sure a TOPOLOGY_CHANGING is sent before TOPOLOGY_CHANGED.
        Hide
        Carsten Ziegeler added a comment -

        Thanks for another patch, Stefan - it's applied now

        Show
        Carsten Ziegeler added a comment - Thanks for another patch, Stefan - it's applied now
        Hide
        Carsten Ziegeler added a comment -

        I think we have a working implementation now, therefore we can close this

        Show
        Carsten Ziegeler added a comment - I think we have a working implementation now, therefore we can close this

          People

          • Assignee:
            Carsten Ziegeler
            Reporter:
            Stefan Egli
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development