JanusGraph / JanusGraph/janusgraph
(Missing) Index Usage Analytics
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
This warning:
```
75604240 [gremlin-server-exec-4] WARN
com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx -
Query requires iterating over all vertices [(~label = Person AND id = 123)].
For better performance, use indexes
```
I believe is generated by [this line](https://github.com/JanusGraph/janusgraph/blob/ec441ac6d87f3359c9740075786ec6de3651745e/janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardJanusGraphTx.java#L1276).
I am thinking about modifying that section of code to try and collect stats that will aggregate missing index information to provide value/cost data in adding indexes to a graph.
e.g. it would collect the data and then summarize like this:
```
Over X days missed indexes resulted in:
[(~label = Person AND id = 123)] - 3,500 queries
[(~label = Person AND name = 'aaa')] - 320 queries
[(~label = Person AND profession = 'developer')] - 2 queries
```
The idea is to discover which missing indexes would be more used than others and are worth considering for addition.
There is also the consideration in adding analytics logging to the other side of the `if...else` which records indexes being used to discover existing indexes that are under-utilized and might be removed to reduce their maintenance cost.
Questions:
1. Would this sort of thing be useful for others and should I consider a PR if I am successful in conditionally adding this?
2. Where would you store and analyze this information? (Sending external keeps the footprint of Janus Graph small but requires users to add an external "receiving" end-point etc. so more difficult to use. Keeping in memory would require more code in the code base to maintain but could be configured to only run when the user wants the analytics.)
3. Does something like this already exist? Or how do you currently analyze and optimize indexes in your installation?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in janusgraph-core/src/main/java/org/janusgraph/graphdb/transaction/StandardJanusGraphTx.java at the referenced warning near line 1276. Review both sides of the index decision and determine what analytics data would be collected and where it could be stored. The issue has no defined acceptance criteria, so the storage, configuration, aggregation, and completion conditions need maintainer agreement first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100