Skip to content

Improve graph performance #191

@oscarlorentzon

Description

@oscarlorentzon

The performance for building the graph is currently bad in areas where there is high node density. The problem has many reasons, the most important one being that tiles are loaded with too many nodes, the nodes contain too much data and the tiles contains all the sequences for all the nodes in the tile. The sequences are retrieved for every tile, i.e. duplicates that are not needed are retrieved for adjacent tiles. The tiles can therefor be vary large which requires good network connection for fast retrieval. The aim of this issue is to completely rebuild the graph implementation to make it fast and dynamic.

To resolve the performance issue, the graph implementation needs to be completely rewritten. When doing this a number of other points should be addressed as well. The new implementation should be written in a way that supports the following:

The idea of the new graph implementation is for data to flow in the following way:

                key 
                 |
                 |
                 v
              imByKey (Core + Spatial + H) ------> Node
                / \                                 |
               /   \                                |
              v     v                               v
           imsByH  seqByKey           Image + Mesh + Core + Spatial
           (Core)   |                               |
              |     |                               |
              |     |                               v
              v     |                          Put on state 
        imsByKey    |                         (i.e. display)
  (bbox, Spatial)   |
              |   / |
              |  /  |
              | /   |
              v     v
   Spatial edges   Sequence edges
               \   /
                \ /
                 v
               Node
                / \                            
               /   \ 
              v     v
           Display arrows

In this way the node could potentially be put on the state once the node assets (image, mesh) have arrived but before the edges have been calculated. The lightweight tiles would not contain heavy node or sequence data and be fast to retrieve. The spatial edge calculation would rely on the heavy data but it would only be retrieved for exactly the image keys that are needed. The rbush spatial index will be used for determining what keys need to be turned in nodes by fetching the heavy node data. The sequence edge calculation would need to fetch the sequences for the nodes that requires edge calculation only. Falcor will be used to cache as well as batch load requests.

The implementation of the new graph issue includes:

  • Data flow through observables from GraphService, Graph, Node and Edges
  • Falcor API usage for building graph
  • Ligthweight tile fetching
  • Heavy imByKey fetching for areas required for edge calculation
  • Two data streams for edge calculation (spatial, sequence)
  • Changed graph, node, state and navigation implementations.

This issue requires breaking changes to the public API, therefor the library version needs to be pushed to 2.0 when implemented.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions