July 06, 2017

System Topology Modeled in a Graph Database

Our landscape, or topology, of systems and their (deployable) components is a rather complex and potentially deep web, or graph, of dependencies.

Figure 1 is an abstract illustration of the nodes and their relationships within this graph…

  • Systems have one or more (deployable) components
  • Each component belongs to a system
  • Components are tagged with one or more tags… REST, UI, PostgreSQL, Oracle, MySQL, S3, Internal, External, .NET, etc.
  • Component deployments, or simply deployments, are deployed to hosts which belong to environments… DEV1, QA1, PRE1, PRD1, PS1, etc.
  • Deployments depend upon other deployments
  • Deployments are consumed by other deployments
  • Environments are data center centric… On-premise, AWS

Figure 1 - System Topology Graph Data Model

Figure 2 is a concrete illustration of the nodes and their relationships within this graph in which a system Foo includes REST and UI components, each of which depend upon a PostgreSQL database.

Figure 2 - System Topology Graph Data Model Example

In using a graph database and specifically, Neo4j, we’re able to answer questions that would be a little tricky with a relational model. Here are just a few queries that illustrate the power of graph databases in dealing with a system topology…

  • Find all production deployments which depend upon the Foo REST production deployment directly…
MATCH p=(source:Deployment{environmentName:'PRDC1'})-[r:DEPENDS_ON]->
        (destination:Deployment{componentName:'Foo REST',environmentName:'PRDC1'})
RETURN p;
  • Find all production deployments which depend upon the Foo REST production deployment directly (or indirectly up to 2 relationships away)…
MATCH p=(source:Deployment{environmentName:'PRDC1'})-[r:DEPENDS_ON*1..2]->
        (destination:Deployment{componentName:'Foo REST',environmentName:'PRDC1'})
RETURN p;
  • Find all components which are tagged UI
MATCH p=(c:Component)-[r:HAS]->
        (t:Tag{tagName: “UI"})
RETURN p;
  • Find all components that belong to the Foo system…
MATCH p=(c:Component)-[r:BELONGS_TO]->
        (s:System {systemName: "Foo"})
RETURN p;
  • Find all deployments deployed to the foo.example.com host…
MATCH p=(d:Deployment)-[:DEPLOYED_TO]->
        (h:Host {hostName: "foo.example.com"})
RETURN p;
  • Find all consumers of the Foo system deployment…
MATCH p=(destination:Deploy)-[r:CONSUMED_BY]->
        (source:Deploy {systemName: "PG: Customer"})
RETURN p;

Tom Muldoon

Software Architect