Date   

Re: Centric Indexes failing to support all conditions for better performance.

chrism <cmil...@...>
 

Thank you, looking forward to have profile() with such information added.
Cheers, CM


On Tuesday, December 15, 2020 at 2:26:02 AM UTC+11 Boxuan Li wrote:
Hi Christopher,

I don't have any workaround in mind except testing and comparing query latencies.

I have created https://github.com/JanusGraph/janusgraph/issues/2283 which hopefully can be addressed before the next release. That being said, there is no planned date for the next release yet.

Btw as I mentioned earlier, if you use "hasNot" it almost never leverages index - no matter if it's a mixed or composite or vertex-centric index.

Best regards,
Boxuan

chrism在 2020年12月14日星期一上午11:56:57 [UTC+8]寫道:
Thank you Boxuan Li, 

It is obvious that your are an expert, is  any other way apart of isFitted=true to know that index is used or not?
(It may be even debugging JanusGraph server or Cassandra)

We need to construct Gremlin query, to utilize these indexes in full, and always,... problem is just what to type,
as our implementation requires more complicated than above conditions to match, using above as sample it would be:
(rating >= value AND time < value) OR HasNot( time )  - means that "time" was not specified.
What is visible from profile() is that we cannot use coalesce() or or() steps, and trying all kind of workarounds 
cannot be verified easily having isFitted=false and no other "good" indication of using indexes.

Cheers, Christopher

On Sunday, December 13, 2020 at 7:24:13 PM UTC+11 li...@... wrote:
Hi Christopher,

isFitted = true basically means no in-memory filtering is needed. If you see isFitted = false, it does not necessarily mean vertex-centric indexes are not used. It could be the case that some vertex-centric index is used, but further in-memory filtering is still needed.
If you see isFitted = false, it does not necessarily mean any index is used. It could be the case that you are fetching all edges of a given vertex.

I totally understand your confusion because the documentation does not explain how the vertex-centric index is built. In JanusGraph, vertices and edges are stored in the “edgestore” store, while composite indexes are stored in the “graphindex” store. Mixed indexes
are stored in external index store like Elasticsearch. This might be a bit counter-intuitive, but vertex-centric indexes are stored in the “edgestore” store. Recall how edges are stored (https://docs.janusgraph.org/advanced-topics/data-model/#individual-edge-layout): 

 
Roughly speaking, If you don’t have any vertex-centric index, then your edge is stored once for one endpoint. If you have one vertex-centric index, then applicable edges are stored twice. If you have two vertex-centric indexes, then applicable edges are stored
three times… These edges, although seemingly duplicate, have different “sort key”s which conform to corresponding vertex-centric indexes. Let’s say you have built an “battlesByRating” vertex-centric index based on the property “rating”, then apart from the
ordinary edge, JanusGraph creates an additional edge whose “sort key” is the rating value. Because the “column” is sorted in the underlying data storage (e.g. “column” in JanusGraph model is mapped to “clustering column” in Cassandra), you essentially gain
the ability to search an index by “rating” value/range.

What happens when your vertex-centric index has two properties like the following?

mgmt.buildEdgeIndex(battled, 'battlesByRatingAndTime', Direction.OUT, Order.asc, rating, time)

Now your “sort key” is a combination of “rating” and “time” (note “rating” comes before “time”). Under this vertex-centric index, “sort key”s look like this:

(rating=1, time=2), (rating=1, time=3), (rating=2, time=1), (rating=2, time=5), (rating=4, time=2), …

This explains why isFitted = true when your query is has('rating', 5.0).has('time', inside(10, 50)) but not when your query is  has(time', 5.0).has(‘rating', inside(10, 50)).Again, note that isFitted = false does not necessarily
mean your query is not optimized by vertex-centric index. I think the profiler shall be improved to state whether and which vertex-centric index is used.

I am not quite sure about the case b) you mentioned. Seems it’s a design consideration but right now I cannot tell why it is there.

“hasNot" almost never uses indexes because JanusGraph cannot index something that does not exist. (Note that “null” value is not valid in JanusGraph).

Hope this helps.

Best regards,
Boxuan

On Dec 10, 2020, at 11:01 AM, chrism <cm...@...> wrote:

is describing usage of Vertex Centrix Index [edge=battled + properties=(rating,time)]
g.V(h).outE('battled').has('rating', 5.0).has('time', inside(10, 50)).inV()

From my understanding profile() of above is reporting \_isFitted=true
to indicate that backend-query delivered all results as conditions: 
\_condition=(rating = 0.5 AND time > 10 AND time < 50 AND type[battled])

Two things are obvious from above: centric index is supporting multiple property keys, and equality and range/interval constraints.
However isFitted is false for all kind of conditions or combinations which are not really breaking the above rules, still in range constraints:

a) g.V(h).outE('battled').has('rating',lt(5.0)).has('time', inside(10, 50)).inV()   // P.lt used for first key
b) g.V(h).outE('battled').has('rating',gt(5.0)) // P.gt used
c) g.V(h).outE('battled').or( hasNot('rating'), has('rating',eq(5.0)) ) // OrStep() used

Even b) can be "fitted" by  has('rating',inside(5.0,Long.MAX_VALUE)) 
all that is very confusing, and probably not working as expected, what I am doing wrong? 
as from my experience only one property key can be used for query conditions and using index, the second is ignored.

Having isFitted=false is not really improving performance, from my understanding,
when one only condition allows to get most of my edges and is asking to filter them in memory,  as this is stated by implementation of BasicVertexCentricQueryBuilder.java.
Are there limitations not described in the JG doco? It is a glitch?

Can you offer explanation how to utilize Centric Indexes for edges in full support? 

Christopher

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgr...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/f8fb537e-216a-462d-928b-ac906eb707a3n%40googlegroups.com.


Re: Property with multiple data types

Laura Morales <laur...@...>
 

Maybe I'm completely wrong, but would I be right to say that "labels" are the equivalent of Java classes? Like, one label represents a Java class and graph properties represent a class properties? So, saying that a node has label L would be like saying that a certain Java object is of class C? (That's why there's only one label per node). I was picturing labels as arbitrary strings that are attached to a node.
Then in Java, classes are namespaced to avoid collision. If my analogy is true, what would be the equivalent of namespaces with Janus?
 
 
 

Sent: Monday, December 14, 2020 at 2:29 PM
From: "HadoopMarc" <bi...@...>
To: "JanusGraph users" <janusgra...@...>
Subject: Re: Property with multiple data types

Hi Laura,
 
Things are a bit different than you ask:

a vertex has a single label onlya property key has a single datatype only, but it can be Object.class, see https://docs.janusgraph.org/basics/schema/#property-key-data-typeindices can have a label constraint, but these are not helpful if you want to mix the datatypes in a property for the same vertexI cannot predict well how the various janusgraph parts will behave when mixing up real integers and "string-integers" in a property key of the Object.class datatype. I guess that the gremlin traversals will have problems, while an indexing backend for MixedIndices probably can deal with it. The ref docs definitely advise to use the basic datatypes and spare yourself future headaches (so, unify the datatypes on ingestion).
Best wishes,    Marc
 

Op maandag 14 december 2020 om 09:07:31 UTC+1 schreef Laura Morales:
Thank you Marc, I think it does indeed! If I understand correctly, I can use labels to "namespace" my nodes, or in other words as a way to identify subgraphs.
If I have a node with 2 labels instead, say label1 and label2, I can create 2 indices for the same node, right? That is an index for label1.age (Integer) and an index for label2.age (String), both indices containing the same node. In this scenario I should be allowed to add 2 types of properties to the same node, one containing an Integer and the other one containing a String. Then query by choosing a specific label. Does this work? Can I do something like this?




Sent: Monday, December 14, 2020 at 8:01 AM
From: "HadoopMarc" <b...@...>
To: "JanusGraph users" <janu...@...>
Subject: Re: Property with multiple data types

Hi Laura,
 
Good that you pay close attention to understanding indices in JanusGraph because they are essential to proper use. Does the following section of the ref docs answers your question?
 
https://docs.janusgraph.org/index-management/index-performance/#label-constraint[https://docs.janusgraph.org/index-management/index-performance/#label-constraint]
 
Best wishes,    Marc 

Op zondag 13 december 2020 om 16:30:19 UTC+1 schreef Laura Morales:I'm new to Janus and LPGs. I have a question after reading the Janus documentation. As far as I understand, edges labels as well as properties (for both nodes and edges) are indexed globally. What happens when I have a sufficiently large graph, that completely unrelated and separate nodes want to use a property called with the same name but that holds different data types? For example, a property called "age" could be used by some nodes with a Integer type (eg. "age": 23), but other nodes on the other far-side of my big graph might want/need/require to use a String type (eg. "age": "twenty-seven"). Is this configuration possible with Janus? Or do I *have to* use two different names such as age_int and age_string?
 
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgr...@...[mailto:janusgr...@...].
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com[https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com?utm_medium=email&utm_source=footer][https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com%5Bhttps://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com?utm_medium=email&utm_source=footer]].
 
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@...[mailto:janusgra...@...].
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/24ee1b44-3501-4d40-abef-b32aa345c959n%40googlegroups.com[https://groups.google.com/d/msgid/janusgraph-users/24ee1b44-3501-4d40-abef-b32aa345c959n%40googlegroups.com?utm_medium=email&utm_source=footer].


Re: Centric Indexes failing to support all conditions for better performance.

Boxuan Li <libox...@...>
 

Hi Christopher,

I don't have any workaround in mind except testing and comparing query latencies.

I have created https://github.com/JanusGraph/janusgraph/issues/2283 which hopefully can be addressed before the next release. That being said, there is no planned date for the next release yet.

Btw as I mentioned earlier, if you use "hasNot" it almost never leverages index - no matter if it's a mixed or composite or vertex-centric index.

Best regards,
Boxuan

chrism在 2020年12月14日星期一上午11:56:57 [UTC+8]寫道:

Thank you Boxuan Li, 

It is obvious that your are an expert, is  any other way apart of isFitted=true to know that index is used or not?
(It may be even debugging JanusGraph server or Cassandra)

We need to construct Gremlin query, to utilize these indexes in full, and always,... problem is just what to type,
as our implementation requires more complicated than above conditions to match, using above as sample it would be:
(rating >= value AND time < value) OR HasNot( time )  - means that "time" was not specified.
What is visible from profile() is that we cannot use coalesce() or or() steps, and trying all kind of workarounds 
cannot be verified easily having isFitted=false and no other "good" indication of using indexes.

Cheers, Christopher

On Sunday, December 13, 2020 at 7:24:13 PM UTC+11 li...@... wrote:
Hi Christopher,

isFitted = true basically means no in-memory filtering is needed. If you see isFitted = false, it does not necessarily mean vertex-centric indexes are not used. It could be the case that some vertex-centric index is used, but further in-memory filtering is still needed.
If you see isFitted = false, it does not necessarily mean any index is used. It could be the case that you are fetching all edges of a given vertex.

I totally understand your confusion because the documentation does not explain how the vertex-centric index is built. In JanusGraph, vertices and edges are stored in the “edgestore” store, while composite indexes are stored in the “graphindex” store. Mixed indexes
are stored in external index store like Elasticsearch. This might be a bit counter-intuitive, but vertex-centric indexes are stored in the “edgestore” store. Recall how edges are stored (https://docs.janusgraph.org/advanced-topics/data-model/#individual-edge-layout): 

 
Roughly speaking, If you don’t have any vertex-centric index, then your edge is stored once for one endpoint. If you have one vertex-centric index, then applicable edges are stored twice. If you have two vertex-centric indexes, then applicable edges are stored
three times… These edges, although seemingly duplicate, have different “sort key”s which conform to corresponding vertex-centric indexes. Let’s say you have built an “battlesByRating” vertex-centric index based on the property “rating”, then apart from the
ordinary edge, JanusGraph creates an additional edge whose “sort key” is the rating value. Because the “column” is sorted in the underlying data storage (e.g. “column” in JanusGraph model is mapped to “clustering column” in Cassandra), you essentially gain
the ability to search an index by “rating” value/range.

What happens when your vertex-centric index has two properties like the following?

mgmt.buildEdgeIndex(battled, 'battlesByRatingAndTime', Direction.OUT, Order.asc, rating, time)

Now your “sort key” is a combination of “rating” and “time” (note “rating” comes before “time”). Under this vertex-centric index, “sort key”s look like this:

(rating=1, time=2), (rating=1, time=3), (rating=2, time=1), (rating=2, time=5), (rating=4, time=2), …

This explains why isFitted = true when your query is has('rating', 5.0).has('time', inside(10, 50)) but not when your query is  has(time', 5.0).has(‘rating', inside(10, 50)).Again, note that isFitted = false does not necessarily
mean your query is not optimized by vertex-centric index. I think the profiler shall be improved to state whether and which vertex-centric index is used.

I am not quite sure about the case b) you mentioned. Seems it’s a design consideration but right now I cannot tell why it is there.

“hasNot" almost never uses indexes because JanusGraph cannot index something that does not exist. (Note that “null” value is not valid in JanusGraph).

Hope this helps.

Best regards,
Boxuan

On Dec 10, 2020, at 11:01 AM, chrism <cm...@...> wrote:

is describing usage of Vertex Centrix Index [edge=battled + properties=(rating,time)]
g.V(h).outE('battled').has('rating', 5.0).has('time', inside(10, 50)).inV()

From my understanding profile() of above is reporting \_isFitted=true
to indicate that backend-query delivered all results as conditions: 
\_condition=(rating = 0.5 AND time > 10 AND time < 50 AND type[battled])

Two things are obvious from above: centric index is supporting multiple property keys, and equality and range/interval constraints.
However isFitted is false for all kind of conditions or combinations which are not really breaking the above rules, still in range constraints:

a) g.V(h).outE('battled').has('rating',lt(5.0)).has('time', inside(10, 50)).inV()   // P.lt used for first key
b) g.V(h).outE('battled').has('rating',gt(5.0)) // P.gt used
c) g.V(h).outE('battled').or( hasNot('rating'), has('rating',eq(5.0)) ) // OrStep() used

Even b) can be "fitted" by  has('rating',inside(5.0,Long.MAX_VALUE)) 
all that is very confusing, and probably not working as expected, what I am doing wrong? 
as from my experience only one property key can be used for query conditions and using index, the second is ignored.

Having isFitted=false is not really improving performance, from my understanding,
when one only condition allows to get most of my edges and is asking to filter them in memory,  as this is stated by implementation of BasicVertexCentricQueryBuilder.java.
Are there limitations not described in the JG doco? It is a glitch?

Can you offer explanation how to utilize Centric Indexes for edges in full support? 

Christopher

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgr...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/f8fb537e-216a-462d-928b-ac906eb707a3n%40googlegroups.com.


Re: Property with multiple data types

Laura Morales <laur...@...>
 

Thank you for your further comments.
I'm still a bit confused though. Janus advertises itself as a database for huge graphs. But I'm asking myself if it means huge "homogeneous" graphs (ie. a simple schema but a lot of nodes/edges) or huge "dishomogeneous" graphs (ie. with lots of nodes/edges but also with a complex schema). With really big graphs I think it's reasonable to assume that different nodes will want to use the same property key but with different data types. Labels however don't really help with this use case, because there can only be 1 per node, and maybe some nodes want to use both types.
How would you design the schema of a big "dishomogeneous" graph? Like a schema that can describe 100s of different domains in a single graph. Is Object.class the only way?




Sent: Monday, December 14, 2020 at 2:29 PM
From: "HadoopMarc" <bi...@...>
To: "JanusGraph users" <janusgra...@...>
Subject: Re: Property with multiple data types

Hi Laura,
 
Things are a bit different than you ask:

a vertex has a single label onlya property key has a single datatype only, but it can be Object.class, see https://docs.janusgraph.org/basics/schema/#property-key-data-typeindices can have a label constraint, but these are not helpful if you want to mix the datatypes in a property for the same vertexI cannot predict well how the various janusgraph parts will behave when mixing up real integers and "string-integers" in a property key of the Object.class datatype. I guess that the gremlin traversals will have problems, while an indexing backend for MixedIndices probably can deal with it. The ref docs definitely advise to use the basic datatypes and spare yourself future headaches (so, unify the datatypes on ingestion).
Best wishes,    Marc
 

Op maandag 14 december 2020 om 09:07:31 UTC+1 schreef Laura Morales:
Thank you Marc, I think it does indeed! If I understand correctly, I can use labels to "namespace" my nodes, or in other words as a way to identify subgraphs.
If I have a node with 2 labels instead, say label1 and label2, I can create 2 indices for the same node, right? That is an index for label1.age (Integer) and an index for label2.age (String), both indices containing the same node. In this scenario I should be allowed to add 2 types of properties to the same node, one containing an Integer and the other one containing a String. Then query by choosing a specific label. Does this work? Can I do something like this?




Sent: Monday, December 14, 2020 at 8:01 AM
From: "HadoopMarc" <b...@...>
To: "JanusGraph users" <janu...@...>
Subject: Re: Property with multiple data types

Hi Laura,
 
Good that you pay close attention to understanding indices in JanusGraph because they are essential to proper use. Does the following section of the ref docs answers your question?
 
https://docs.janusgraph.org/index-management/index-performance/#label-constraint[https://docs.janusgraph.org/index-management/index-performance/#label-constraint]
 
Best wishes,    Marc 

Op zondag 13 december 2020 om 16:30:19 UTC+1 schreef Laura Morales:I'm new to Janus and LPGs. I have a question after reading the Janus documentation. As far as I understand, edges labels as well as properties (for both nodes and edges) are indexed globally. What happens when I have a sufficiently large graph, that completely unrelated and separate nodes want to use a property called with the same name but that holds different data types? For example, a property called "age" could be used by some nodes with a Integer type (eg. "age": 23), but other nodes on the other far-side of my big graph might want/need/require to use a String type (eg. "age": "twenty-seven"). Is this configuration possible with Janus? Or do I *have to* use two different names such as age_int and age_string?
 
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgr...@...[mailto:janusgr...@...].
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com[https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com?utm_medium=email&utm_source=footer][https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com%5Bhttps://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com?utm_medium=email&utm_source=footer]].
 
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@...[mailto:janusgra...@...].
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/24ee1b44-3501-4d40-abef-b32aa345c959n%40googlegroups.com[https://groups.google.com/d/msgid/janusgraph-users/24ee1b44-3501-4d40-abef-b32aa345c959n%40googlegroups.com?utm_medium=email&utm_source=footer].


Re: Property with multiple data types

HadoopMarc <bi...@...>
 

Hi Laura,

Things are a bit different than you ask:
  • a vertex has a single label only
  • a property key has a single datatype only, but it can be Object.class, see https://docs.janusgraph.org/basics/schema/#property-key-data-type
  • indices can have a label constraint, but these are not helpful if you want to mix the datatypes in a property for the same vertex
  • I cannot predict well how the various janusgraph parts will behave when mixing up real integers and "string-integers" in a property key of the Object.class datatype. I guess that the gremlin traversals will have problems, while an indexing backend for MixedIndices probably can deal with it. The ref docs definitely advise to use the basic datatypes and spare yourself future headaches (so, unify the datatypes on ingestion).
Best wishes,    Marc

Op maandag 14 december 2020 om 09:07:31 UTC+1 schreef Laura Morales:


Thank you Marc, I think it does indeed! If I understand correctly, I can use labels to "namespace" my nodes, or in other words as a way to identify subgraphs.
If I have a node with 2 labels instead, say label1 and label2, I can create 2 indices for the same node, right? That is an index for label1.age (Integer) and an index for label2.age (String), both indices containing the same node. In this scenario I should be allowed to add 2 types of properties to the same node, one containing an Integer and the other one containing a String. Then query by choosing a specific label. Does this work? Can I do something like this?




Sent: Monday, December 14, 2020 at 8:01 AM
From: "HadoopMarc" <b...@...>
To: "JanusGraph users" <janu...@...>
Subject: Re: Property with multiple data types

Hi Laura,
 
Good that you pay close attention to understanding indices in JanusGraph because they are essential to proper use. Does the following section of the ref docs answers your question?
 
https://docs.janusgraph.org/index-management/index-performance/#label-constraint
 
Best wishes,    Marc 

Op zondag 13 december 2020 om 16:30:19 UTC+1 schreef Laura Morales:I'm new to Janus and LPGs. I have a question after reading the Janus documentation. As far as I understand, edges labels as well as properties (for both nodes and edges) are indexed globally. What happens when I have a sufficiently large graph, that completely unrelated and separate nodes want to use a property called with the same name but that holds different data types? For example, a property called "age" could be used by some nodes with a Integer type (eg. "age": 23), but other nodes on the other far-side of my big graph might want/need/require to use a String type (eg. "age": "twenty-seven"). Is this configuration possible with Janus? Or do I *have to* use two different names such as age_int and age_string?
 
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgr...@...[mailto:janusgr...@...].
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com[https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com?utm_medium=email&utm_source=footer].


Re: Is there a standard, human-friendly, serialization format?

Evgeniy Ignatiev <yevgeniy...@...>
 

Hi Laura,

Many people use CSV for data and JSON for schemas (in other graph databases too). Not sure what will be the most "standard" or "efficient" approach, but CSV/JSON seems to be most common. For example https://github.com/IBM/janusgraph-utils and https://github.com/dengziming/janusgraph-util

Best regards,
Evgenii Ignatev.

On 14.12.2020 09:22, Laura Morales wrote:
All the examples that I see in the Janus documentation seem to use Groovy. Instructions such as JanusGraphFactory.open(), graph.openManagement(), mgmt.makeEdgeLabel() etc.
Is there any human-friendly plaintext format that I can use to write my graph with, and then load into Janus? In practical terms what I would like to do is this:

1. write my graph in a text file, all nodes and edges, and the schema too. So the format should be human-friendly and easy to edit manually. Hopefully not XML.
2. load this graph into Janus by asking Janus to read my graph file. Not in-memory though, I mean to create a new persistent database that is always there when Janus starts.


Is there a standard, human-friendly, serialization format?

Laura Morales <laur...@...>
 

All the examples that I see in the Janus documentation seem to use Groovy. Instructions such as JanusGraphFactory.open(), graph.openManagement(), mgmt.makeEdgeLabel() etc.
Is there any human-friendly plaintext format that I can use to write my graph with, and then load into Janus? In practical terms what I would like to do is this:

1. write my graph in a text file, all nodes and edges, and the schema too. So the format should be human-friendly and easy to edit manually. Hopefully not XML.
2. load this graph into Janus by asking Janus to read my graph file. Not in-memory though, I mean to create a new persistent database that is always there when Janus starts.


Re: Property with multiple data types

Laura Morales <laur...@...>
 

Thank you Marc, I think it does indeed! If I understand correctly, I can use labels to "namespace" my nodes, or in other words as a way to identify subgraphs.
If I have a node with 2 labels instead, say label1 and label2, I can create 2 indices for the same node, right? That is an index for label1.age (Integer) and an index for label2.age (String), both indices containing the same node. In this scenario I should be allowed to add 2 types of properties to the same node, one containing an Integer and the other one containing a String. Then query by choosing a specific label. Does this work? Can I do something like this?




Sent: Monday, December 14, 2020 at 8:01 AM
From: "HadoopMarc" <bi...@...>
To: "JanusGraph users" <janusgra...@...>
Subject: Re: Property with multiple data types

Hi Laura,
 
Good that you pay close attention to understanding indices in JanusGraph because they are essential to proper use. Does the following section of the ref docs answers your question?
 
https://docs.janusgraph.org/index-management/index-performance/#label-constraint
 
Best wishes,    Marc 

Op zondag 13 december 2020 om 16:30:19 UTC+1 schreef Laura Morales:I'm new to Janus and LPGs. I have a question after reading the Janus documentation. As far as I understand, edges labels as well as properties (for both nodes and edges) are indexed globally. What happens when I have a sufficiently large graph, that completely unrelated and separate nodes want to use a property called with the same name but that holds different data types? For example, a property called "age" could be used by some nodes with a Integer type (eg. "age": 23), but other nodes on the other far-side of my big graph might want/need/require to use a String type (eg. "age": "twenty-seven"). Is this configuration possible with Janus? Or do I *have to* use two different names such as age_int and age_string?
 
--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@...[mailto:janusgra...@...].
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com[https://groups.google.com/d/msgid/janusgraph-users/0b84be68-3688-46fe-a104-32baef119e2an%40googlegroups.com?utm_medium=email&utm_source=footer].


Re: Property with multiple data types

HadoopMarc <bi...@...>
 

Hi Laura,

Good that you pay close attention to understanding indices in JanusGraph because they are essential to proper use. Does the following section of the ref docs answers your question?

https://docs.janusgraph.org/index-management/index-performance/#label-constraint

Best wishes,    Marc

Op zondag 13 december 2020 om 16:30:19 UTC+1 schreef Laura Morales:

I'm new to Janus and LPGs. I have a question after reading the Janus documentation. As far as I understand, edges labels as well as properties (for both nodes and edges) are indexed globally. What happens when I have a sufficiently large graph, that completely unrelated and separate nodes want to use a property called with the same name but that holds different data types? For example, a property called "age" could be used by some nodes with a Integer type (eg. "age": 23), but other nodes on the other far-side of my big graph might want/need/require to use a String type (eg. "age": "twenty-seven"). Is this configuration possible with Janus? Or do I *have to* use two different names such as age_int and age_string?


Re: Centric Indexes failing to support all conditions for better performance.

chrism <cmil...@...>
 

Thank you Boxuan Li, 

It is obvious that your are an expert, is  any other way apart of isFitted=true to know that index is used or not?
(It may be even debugging JanusGraph server or Cassandra)

We need to construct Gremlin query, to utilize these indexes in full, and always,... problem is just what to type,
as our implementation requires more complicated than above conditions to match, using above as sample it would be:
(rating >= value AND time < value) OR HasNot( time )  - means that "time" was not specified.
What is visible from profile() is that we cannot use coalesce() or or() steps, and trying all kind of workarounds 
cannot be verified easily having isFitted=false and no other "good" indication of using indexes.

Cheers, Christopher

On Sunday, December 13, 2020 at 7:24:13 PM UTC+11 li...@... wrote:
Hi Christopher,

isFitted = true basically means no in-memory filtering is needed. If you see isFitted = false, it does not necessarily mean vertex-centric indexes are not used. It could be the case that some vertex-centric index is used, but further in-memory filtering is still needed.
If you see isFitted = false, it does not necessarily mean any index is used. It could be the case that you are fetching all edges of a given vertex.

I totally understand your confusion because the documentation does not explain how the vertex-centric index is built. In JanusGraph, vertices and edges are stored in the “edgestore” store, while composite indexes are stored in the “graphindex” store. Mixed indexes
are stored in external index store like Elasticsearch. This might be a bit counter-intuitive, but vertex-centric indexes are stored in the “edgestore” store. Recall how edges are stored (https://docs.janusgraph.org/advanced-topics/data-model/#individual-edge-layout): 

 
Roughly speaking, If you don’t have any vertex-centric index, then your edge is stored once for one endpoint. If you have one vertex-centric index, then applicable edges are stored twice. If you have two vertex-centric indexes, then applicable edges are stored
three times… These edges, although seemingly duplicate, have different “sort key”s which conform to corresponding vertex-centric indexes. Let’s say you have built an “battlesByRating” vertex-centric index based on the property “rating”, then apart from the
ordinary edge, JanusGraph creates an additional edge whose “sort key” is the rating value. Because the “column” is sorted in the underlying data storage (e.g. “column” in JanusGraph model is mapped to “clustering column” in Cassandra), you essentially gain
the ability to search an index by “rating” value/range.

What happens when your vertex-centric index has two properties like the following?

mgmt.buildEdgeIndex(battled, 'battlesByRatingAndTime', Direction.OUT, Order.asc, rating, time)

Now your “sort key” is a combination of “rating” and “time” (note “rating” comes before “time”). Under this vertex-centric index, “sort key”s look like this:

(rating=1, time=2), (rating=1, time=3), (rating=2, time=1), (rating=2, time=5), (rating=4, time=2), …

This explains why isFitted = true when your query is has('rating', 5.0).has('time', inside(10, 50)) but not when your query is  has(time', 5.0).has(‘rating', inside(10, 50)).Again, note that isFitted = false does not necessarily
mean your query is not optimized by vertex-centric index. I think the profiler shall be improved to state whether and which vertex-centric index is used.

I am not quite sure about the case b) you mentioned. Seems it’s a design consideration but right now I cannot tell why it is there.

“hasNot" almost never uses indexes because JanusGraph cannot index something that does not exist. (Note that “null” value is not valid in JanusGraph).

Hope this helps.

Best regards,
Boxuan

On Dec 10, 2020, at 11:01 AM, chrism <cm...@...> wrote:

is describing usage of Vertex Centrix Index [edge=battled + properties=(rating,time)]
g.V(h).outE('battled').has('rating', 5.0).has('time', inside(10, 50)).inV()

From my understanding profile() of above is reporting \_isFitted=true
to indicate that backend-query delivered all results as conditions: 
\_condition=(rating = 0.5 AND time > 10 AND time < 50 AND type[battled])

Two things are obvious from above: centric index is supporting multiple property keys, and equality and range/interval constraints.
However isFitted is false for all kind of conditions or combinations which are not really breaking the above rules, still in range constraints:

a) g.V(h).outE('battled').has('rating',lt(5.0)).has('time', inside(10, 50)).inV()   // P.lt used for first key
b) g.V(h).outE('battled').has('rating',gt(5.0)) // P.gt used
c) g.V(h).outE('battled').or( hasNot('rating'), has('rating',eq(5.0)) ) // OrStep() used

Even b) can be "fitted" by  has('rating',inside(5.0,Long.MAX_VALUE)) 
all that is very confusing, and probably not working as expected, what I am doing wrong? 
as from my experience only one property key can be used for query conditions and using index, the second is ignored.

Having isFitted=false is not really improving performance, from my understanding,
when one only condition allows to get most of my edges and is asking to filter them in memory,  as this is stated by implementation of BasicVertexCentricQueryBuilder.java.
Are there limitations not described in the JG doco? It is a glitch?

Can you offer explanation how to utilize Centric Indexes for edges in full support? 

Christopher

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgr...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/f8fb537e-216a-462d-928b-ac906eb707a3n%40googlegroups.com.


Property with multiple data types

Laura Morales <laur...@...>
 

I'm new to Janus and LPGs. I have a question after reading the Janus documentation. As far as I understand, edges labels as well as properties (for both nodes and edges) are indexed globally. What happens when I have a sufficiently large graph, that completely unrelated and separate nodes want to use a property called with the same name but that holds different data types? For example, a property called "age" could be used by some nodes with a Integer type (eg. "age": 23), but other nodes on the other far-side of my big graph might want/need/require to use a String type (eg. "age": "twenty-seven"). Is this configuration possible with Janus? Or do I *have to* use two different names such as age_int and age_string?


subscribe

Laura Morales <laur...@...>
 

subscribe


Re: Centric Indexes failing to support all conditions for better performance.

BO XUAN LI <libo...@...>
 

Hi Christopher,

isFitted = true basically means no in-memory filtering is needed. If you see isFitted = false, it does not necessarily mean vertex-centric indexes are not used. It could be the case that some vertex-centric index is used, but further in-memory filtering is still needed.
If you see isFitted = false, it does not necessarily mean any index is used. It could be the case that you are fetching all edges of a given vertex.

I totally understand your confusion because the documentation does not explain how the vertex-centric index is built. In JanusGraph, vertices and edges are stored in the “edgestore” store, while composite indexes are stored in the “graphindex” store. Mixed indexes
are stored in external index store like Elasticsearch. This might be a bit counter-intuitive, but vertex-centric indexes are stored in the “edgestore” store. Recall how edges are stored (https://docs.janusgraph.org/advanced-topics/data-model/#individual-edge-layout): 

 
Roughly speaking, If you don’t have any vertex-centric index, then your edge is stored once for one endpoint. If you have one vertex-centric index, then applicable edges are stored twice. If you have two vertex-centric indexes, then applicable edges are stored
three times… These edges, although seemingly duplicate, have different “sort key”s which conform to corresponding vertex-centric indexes. Let’s say you have built an “battlesByRating” vertex-centric index based on the property “rating”, then apart from the
ordinary edge, JanusGraph creates an additional edge whose “sort key” is the rating value. Because the “column” is sorted in the underlying data storage (e.g. “column” in JanusGraph model is mapped to “clustering column” in Cassandra), you essentially gain
the ability to search an index by “rating” value/range.

What happens when your vertex-centric index has two properties like the following?

mgmt.buildEdgeIndex(battled, 'battlesByRatingAndTime', Direction.OUT, Order.asc, rating, time)

Now your “sort key” is a combination of “rating” and “time” (note “rating” comes before “time”). Under this vertex-centric index, “sort key”s look like this:

(rating=1, time=2), (rating=1, time=3), (rating=2, time=1), (rating=2, time=5), (rating=4, time=2), …

This explains why isFitted = true when your query is has('rating', 5.0).has('time', inside(10, 50)) but not when your query is  has(time', 5.0).has(‘rating', inside(10, 50)).Again, note that isFitted = false does not necessarily
mean your query is not optimized by vertex-centric index. I think the profiler shall be improved to state whether and which vertex-centric index is used.

I am not quite sure about the case b) you mentioned. Seems it’s a design consideration but right now I cannot tell why it is there.

“hasNot" almost never uses indexes because JanusGraph cannot index something that does not exist. (Note that “null” value is not valid in JanusGraph).

Hope this helps.

Best regards,
Boxuan

On Dec 10, 2020, at 11:01 AM, chrism <cmil...@...> wrote:

is describing usage of Vertex Centrix Index [edge=battled + properties=(rating,time)]
g.V(h).outE('battled').has('rating', 5.0).has('time', inside(10, 50)).inV()

From my understanding profile() of above is reporting \_isFitted=true
to indicate that backend-query delivered all results as conditions: 
\_condition=(rating = 0.5 AND time > 10 AND time < 50 AND type[battled])

Two things are obvious from above: centric index is supporting multiple property keys, and equality and range/interval constraints.
However isFitted is false for all kind of conditions or combinations which are not really breaking the above rules, still in range constraints:

a) g.V(h).outE('battled').has('rating',lt(5.0)).has('time', inside(10, 50)).inV()   // P.lt used for first key
b) g.V(h).outE('battled').has('rating',gt(5.0)) // P.gt used
c) g.V(h).outE('battled').or( hasNot('rating'), has('rating',eq(5.0)) ) // OrStep() used

Even b) can be "fitted" by  has('rating',inside(5.0,Long.MAX_VALUE)) 
all that is very confusing, and probably not working as expected, what I am doing wrong? 
as from my experience only one property key can be used for query conditions and using index, the second is ignored.

Having isFitted=false is not really improving performance, from my understanding,
when one only condition allows to get most of my edges and is asking to filter them in memory,  as this is stated by implementation of BasicVertexCentricQueryBuilder.java.
Are there limitations not described in the JG doco? It is a glitch?

Can you offer explanation how to utilize Centric Indexes for edges in full support? 

Christopher

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgra...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/f8fb537e-216a-462d-928b-ac906eb707a3n%40googlegroups.com.


Re: Configuring Transaction Log feature

Sandeep Mishra <sandy...@...>
 

Pawan, 
I was able to make your code work. the problem is "setStartTimeNow()" 
Instead use  setStartTime(Instant.now()) and test. It works. I am yet to explore difference between two api.
make sure to use a new logidentifier to test.

Regards,
Sandeep  

On Wednesday, December 9, 2020 at 8:54:17 PM UTC+8 shr...@... wrote:
Hi Sandeep,

I think I have already added below line to indicate that it should pull the detail from now onwords in processor. Is it not working?

 "setStartTimeNow()"

Is anyone other face the same thing in their java code? 

Thanks,
Pawan

On Friday, 4 December 2020 at 16:22:51 UTC+5:30 sa...@... wrote:
pawan,
can you check for following in your logs Loaded unidentified ReadMarker start time...
seems your readmarker is starting from 1970. so it tries to read changes since then

Regards,
Sandeep
On Saturday, November 28, 2020 at 8:48:18 PM UTC+8 shr...@... wrote:
one correction to last post in below line.

    JanusGraphTransaction tx = graph.buildTransaction().logIdentifier("TestLog").start();



On Saturday, 28 November 2020 at 18:16:09 UTC+5:30 Pawan Shriwas wrote:
Hi Sandeep,

Please see below java code and properties information which I am trying in local with Cassandra cql as backend.  This code is not giving me the change log as event which I can get via gremlin console with same script and properties. Please let me know if anything needs to be modify here with code or properties.

<!-- Java Code -->
package com.example.graph;

import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.JanusGraphFactory;
import org.janusgraph.core.JanusGraphTransaction;
import org.janusgraph.core.JanusGraphVertex;
import org.janusgraph.core.log.ChangeProcessor;
import org.janusgraph.core.log.ChangeState;
import org.janusgraph.core.log.LogProcessorFramework;
import org.janusgraph.core.log.TransactionId;

public class TestLog {
public static void listenLogsEvent(){
JanusGraph graph = JanusGraphFactory.open("/home/ist/Downloads/IM/jgraphdb_local.properties");
LogProcessorFramework logProcessor = JanusGraphFactory.openTransactionLog(graph);

logProcessor.addLogProcessor("TestLog").
    setProcessorIdentifier("TestLogCounter").
    setStartTimeNow().
    addProcessor(new ChangeProcessor(){
        @Override
        public void process(JanusGraphTransaction tx, TransactionId txId, ChangeState changeState) {
        System.out.println("tx--"+tx.toString());
        System.out.println("txId--"+txId.toString());
        System.out.println("changeState--"+changeState.toString());
       }
    }).
    build();
for(int i=0;i<=10;i++) {
        System.out.println("going to add ="+i);
    JanusGraphTransaction tx = graph.buildTransaction().logIdentifier("PawanTestLog").start();
    JanusGraphVertex a = tx.addVertex("TimeL");
    a.property("type", "HOLD");
    a.property("serialNo", "XS31B4");
    tx.commit();
        System.out.println("Vertex committed ="+a.toString());
}
}
public static void main(String[] args) {
System.out.println("starting main");
listenLogsEvent();
}
}

<!----- graph properties------->
gremlin.graph=org.janusgraph.core.JanusGraphFactory
graph.name=TestGraph
storage.backend = cql
storage.hostname = localhost
storage.cql.keyspace=janusgraphcql
query.fast-property = true
storage.lock.wait-time=10000
storage.batch-loading=true

Thanks in advance.

Thanks,
Pawan


On Saturday, 28 November 2020 at 16:19:20 UTC+5:30 sa...@... wrote:
Pawan,
Can you elaborate more on the program where your are trying to embed the script in?
Regards,
Sandeep

On Sat, 28 Nov 2020, 13:48 Pawan Shriwas, <shr...@...> wrote:
Hey Jason,

Same thing happen with my as well where above script work well in gremlin console  but when we use it in java. we are not getting anything in process() section as callback. Could you help for the same.  


On Wednesday, 7 February 2018 at 20:28:41 UTC+5:30 Jason Plurad wrote:
It means that it will use the 'storage.backend' value as the storage. See the code in GraphDatabaseConfiguration.java. It looks like your only choice is 'default', and it seems like the option is there for the future possibility to use a different backend.

The code in the docs seemed to work ok, other than a minor change in the setStartTime() parameters. You can cut and paste this code into the Gremlin Console to use with the prepackaged distribution.

import java.util.concurrent.atomic.*;
import org.janusgraph.core.log.*;
import java.util.concurrent.*;

graph
= JanusGraphFactory.open('conf/janusgraph-cassandra-es.properties');

totalHumansAdded
= new AtomicInteger(0);
totalGodsAdded
= new AtomicInteger(0);
logProcessor
= JanusGraphFactory.openTransactionLog(graph);
logProcessor
.addLogProcessor("addedPerson").
        setProcessorIdentifier
("addedPersonCounter").
        setStartTime
(Instant.now()).
        addProcessor
(new ChangeProcessor() {
           
public void process(JanusGraphTransaction tx, TransactionId txId, ChangeState changeState) {
               
for (v in changeState.getVertices(Change.ADDED)) {
                   
if (v.label().equals("human")) totalHumansAdded.incrementAndGet();
                   
System.out.println("total humans = " + totalHumansAdded);
               
}
           
}
       
}).
        addProcessor
(new ChangeProcessor() {
           
public void process(JanusGraphTransaction tx, TransactionId txId, ChangeState changeState) {
               
for (v in changeState.getVertices(Change.ADDED)) {
                   
if (v.label().equals("god")) totalGodsAdded.incrementAndGet();
                   
System.out.println("total gods = " + totalGodsAdded);
               
}
           
}
       
}).
        build
()

tx
= graph.buildTransaction().logIdentifier("addedPerson").start();
u
= tx.addVertex(T.label, "human");
u
.property("name", "proteros");
u
.property("age", 36);
tx
.commit();

If you inspect the keyspace in Cassandra afterwards, you'll see that a separate table is created for "ulog_addedPerson".

Did you have some example code of what you are attempting?



On Wednesday, February 7, 2018 at 5:55:58 AM UTC-5, Sandeep Mishra wrote:
Hi Guys,

We are trying to used transaction log feature of Janusgraph, which is not working as expected.No callback is received at
public void process(JanusGraphTransaction janusGraphTransaction, TransactionId transactionId, ChangeState changeState) {

Janusgraph documentation says value for log.[X].backend is 'default'.
Not sure what exactly it means. does it mean HBase which is being used as backend for data.

Please let  me know, if anyone has configured it.

Thanks and Regards,
Sandeep Mishra

--
You received this message because you are subscribed to a topic in the Google Groups "JanusGraph users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/janusgraph-users/JN4ZsB9_DMM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to janusgr...@....


Re: Error when running JanusGraph with YARN and CQL

Varun Ganesh <operatio...@...>
 

Thanks a lot for responding Marc.

Yes, I had initially tried setting spark.yarn.archive with the path to spark-gremlin.zip. However with this approach, the containers were failing with the message "Error: Could not find or load main class org.apache.spark.deploy.yarn.ExecutorLauncher".

I'm yet to understand the differences between the spark.yarn.archive and the HADOOP_GREMLIN_LIBS approaches. Will update this thread as I find out more.

Thank you,
Varun

On Friday, December 11, 2020 at 2:05:35 AM UTC-5 HadoopMarc wrote:
Hi Varun,

Good job. However, your last solution will only work with everything running on a single machine. So, indeed, there is something wrong with the contents of spark-gremlin.zip or with the way it is put in the executor's local working directory. Note that you already put /Users/my_comp/Downloads/janusgraph-0.5.2/lib/janusgraph-cql-0.5.2.jar explicitly on the executor classpath while it should have been available already through ./spark-gremlin.zip/*

O, I think I see now what is different. You have used spark.yarn.dist.archives, while the TinkerPop recipes use spark.yarn.archive. They behave differently in yes/no extracting the jars from the zip. I guess either can be used, provided it is done consistently. You can use the environment tab in Spark web UI to inspect how things are picked up by spark.

Best wishes,    Marc

Op donderdag 10 december 2020 om 20:23:32 UTC+1 schreef Varun Ganesh:
Answering my own question. I was able fix the above error and successfully run the count job after explicitly adding /Users/my_comp/Downloads/janusgraph-0.5.2/lib/* to spark.executor.extraClassPath

But I am not yet sure as to why that was needed. I had assumed that adding spark-gremlin.zip to the path would have provided the required dependencies.

On Thursday, December 10, 2020 at 1:00:24 PM UTC-5 Varun Ganesh wrote:
An update on this, I tried setting the env var below:

export HADOOP_GREMLIN_LIBS=$GREMLIN_HOME/lib

After doing this I was able to successfully run the tinkerpop-modern.kryo example from the Recipes documentation
(though the guide at http://yaaics.blogspot.com/2017/07/configuring-janusgraph-for-spark-yarn.html explicitly asks us to ignore this)

Unfortunately, it is still not working with CQL. But the error is now different. Please see below:

12:46:33 ERROR org.apache.spark.scheduler.TaskSetManager - Task 3 in stage 0.0 failed 4 times; aborting job
org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 4 times, most recent failure: Lost task 3.3 in stage 0.0 (TID 9, 192.168.1.160, executor 2): java.lang.NoClassDefFoundError: org/janusgraph/hadoop/formats/util/HadoopInputFormat
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
... (skipping)
Caused by: java.lang.ClassNotFoundException: org.janusgraph.hadoop.formats.util.HadoopInputFormat
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 130 more

Is there some additional dependency that I may need to add?

Thanks in advance!
On Wednesday, December 9, 2020 at 11:49:29 PM UTC-5 Varun Ganesh wrote:
Hello,

I am trying to run SparkGraphComputer on a JanusGraph backed by Cassandra and ElasticSearch. I have previously verified that I am able to run SparkGraphComputer on a local Spark standalone cluster.

I am now trying to run it on YARN. I have a local YARN cluster running and I have verified that it can run Spark jobs.

I followed the following links:

And here is my read-cql-yarn.properties file:
gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
gremlin.hadoop.graphReader=org.janusgraph.hadoop.formats.cql.CqlInputFormat
gremlin.hadoop.graphWriter=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat

gremlin.hadoop.jarsInDistributedCache=true
gremlin.hadoop.inputLocation=none
gremlin.hadoop.outputLocation=output
gremlin.spark.persistContext=true

#
# JanusGraph Cassandra InputFormat configuration
#
# These properties defines the connection properties which were used while write data to JanusGraph.
janusgraphmr.ioformat.conf.storage.backend=cql
# This specifies the hostname & port for Cassandra data store.
janusgraphmr.ioformat.conf.storage.hostname=127.0.0.1
janusgraphmr.ioformat.conf.storage.port=9042
# This specifies the keyspace where data is stored.
janusgraphmr.ioformat.conf.storage.cql.keyspace=janusgraph
# This defines the indexing backend configuration used while writing data to JanusGraph.
janusgraphmr.ioformat.conf.index.search.backend=elasticsearch
janusgraphmr.ioformat.conf.index.search.hostname=127.0.0.1
# Use the appropriate properties for the backend when using a different storage backend (HBase) or indexing backend (Solr).

#
# Apache Cassandra InputFormat configuration
#
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner
cassandra.input.widerows=true

#
# SparkGraphComputer Configuration
#
spark.master=yarn
spark.submit.deployMode=client
spark.executor.memory=1g

spark.yarn.dist.archives=/tmp/spark-gremlin.zip
spark.yarn.dist.files=/Users/my_comp/Downloads/janusgraph-0.5.2/lib/janusgraph-cql-0.5.2.jar
spark.yarn.appMasterEnv.CLASSPATH=/Users/my_comp/Downloads/hadoop-2.7.2/etc/hadoop:./spark-gremlin.zip/*
spark.executor.extraClassPath=/Users/my_comp/Downloads/hadoop-2.7.2/etc/hadoop:/Users/my_comp/Downloads/janusgraph-0.5.2/lib/janusgraph-cql-0.5.2.jar:./spark-gremlin.zip/*

spark.driver.extraLibraryPath=/Users/my_comp/Downloads/hadoop-2.7.2/lib/native:/Users/my_comp/Downloads/hadoop-2.7.2/lib/native/Linux-amd64-64
spark.executor.extraLibraryPath=/Users/my_comp/Downloads/hadoop-2.7.2/lib/native:/Users/my_comp/Downloads/hadoop-2.7.2/lib/native/Linux-amd64-64

spark.serializer=org.apache.spark.serializer.KryoSerializer
spark.kryo.registrator=org.janusgraph.hadoop.serialize.JanusGraphKryoRegistrator

After a bunch of trial and error, I was able to get it to a point where I see containers starting up on my YARN Resource manager UI (port 8088)

Here is the code I am running (it's a simple count):
gremlin> graph = GraphFactory.open('conf/hadoop-graph/read-cql-yarn.properties')
==>hadoopgraph[cqlinputformat->nulloutputformat]
gremlin> g = graph.traversal().withComputer(SparkGraphComputer)
==>graphtraversalsource[hadoopgraph[cqlinputformat->nulloutputformat], sparkgraphcomputer]
gremlin> g.V().count()

However I am encountering the following failure:
18:49:03 ERROR org.apache.spark.scheduler.TaskSetManager - Task 2 in stage 0.0 failed 4 times; aborting job
org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 0.0 failed 4 times, most recent failure: Lost task 2.3 in stage 0.0 (TID 10, 192.168.1.160, executor 1): java.lang.IllegalStateException: unread block data
at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2862)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1682)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2366)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2290)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2148)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1647)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:483)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:441)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:75)
at org.apache.spark.serializer.JavaSerializerInstance.deserialize(JavaSerializer.scala:114)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:370)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Would really appricate it if someone could shed some light on this error and advise on next steps!

Thank you!


Re: How to improve traversal query performance

HadoopMarc <bi...@...>
 

Hi Manabu,

Yes, providing an example graph works much better in exploring the problem space.  I am afraid, though, that I did not find much that will help you out.
  • on a single machine with cassandra and using gremlin console with embedded janusgraph, the total query times stated by profile() deviated significantly from the experienced wall clock times even when everything had a cold start:
                                                                    total profile (ms)               System.currentTimeMillis(ms)
    repeat query, no query-batch             1113                                      1775
    repeat query                                           622                                       1096  
    repeat query (warm caches)                 40                                         360
    Did you do any wall clock query performance tests on your production system with warmed caches? Results might be better - or worse - than suggested by profile().
  • the values 5, 161, 9, 8,... under the repeat step add up to the number of touched edges (2828) in the graph. For this generated graph the number of traversers (2925) is dominated by this number of edges. Trying to bulk any intermediate results using sack will have little effect (in contrary to what I suggested earlier). From another perspective, you can check that the following query without any path references still results in the same number of 2925 traversers:
    g.V().has('serial', within(startIds)).repeat(inE('assembled').outV()).emit().profile()
  • other people wanting to play with this graph should use the following line in Manabu's code:
    columns = line.split(' ', -1)
So, concluding, there does not seem to be much you can do about the query: you simply want a large resultset from a traversal with multiple steps. Depending on the size of you graph, you could hod the graph in memory using the inmemory backend, or you could replace cassandra with cql and put on it on infrastructure with SSD storage. Of course, you could also precompute and store results, or split up the query with repeat().times(1), repeat().times(2), etc. for faster intermediate results.

Best wishes,    Marc


Op dinsdag 8 december 2020 om 08:56:03 UTC+1 schreef Manabu Kotani:

Hi Marc,

Profile outputs I tried.

1. g.V().has('serial',within('XXXXXX','YYYYYY')).inE('assembled').outV()
----------------------------------------------------------------------
gremlin> g.V().has('serial', within('1654145144','1648418968','1652445288','1654952168','1653379120','1654325440','1653383216','1658298568','1649680536','1649819672','1654964456','1649729552','1656103144','1655460032','1656111336','1654669360')).inE('assembled').outV().profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[serial.within([1654145144, 1...                    16          16          18.860    63.13
    \_condition=((serial = 1654145144 OR serial = 1648418968 OR serial = 1652445288 OR serial = 1654952168 OR
               serial = 1653379120 OR serial = 1654325440 OR serial = 1653383216 OR serial = 1658298568 OR se
               rial = 1649680536 OR serial = 1649819672 OR serial = 1654964456 OR serial = 1649729552 OR seri
               al = 1656103144 OR serial = 1655460032 OR serial = 1656111336 OR serial = 1654669360))
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=multiKSQ[16]@2000
    \_index=bySerial
  optimization                                                                                 0.058
  optimization                                                                                 0.694
  backend-query                                                       16                      17.823
    \_query=bySerial:multiKSQ[16]@2000
    \_limit=2000
JanusGraphVertexStep(IN,[assembled],vertex)                           73          73          11.016    36.87
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_multi=true
    \_vertices=16
  optimization                                                                                 0.205
  backend-query                                                       73                       9.332
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
                                            >TOTAL                     -           -          29.877        -

2. g.V().has('serial',within('XXXXXX','YYYYYY')).as('a').in('assembled').inE('assembled').where(outV(), neq('a')).outV()            // query not tested
----------------------------------------------------------------------
gremlin> g.V().has('serial', within('1654145144','1648418968','1652445288','1654952168','1653379120','1654325440','1653383216','1658298568','1649680536','1649819672','1654964456','1649729552','1656103144','1655460032','1656111336','1654669360')).as('a').in('assembled').inE('assembled').where(outV().is(neq('a'))).outV().profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[serial.within([1654145144, 1...                    16          16          19.980    26.52
    \_condition=((serial = 1654145144 OR serial = 1648418968 OR serial = 1652445288 OR serial = 1654952168 OR
               serial = 1653379120 OR serial = 1654325440 OR serial = 1653383216 OR serial = 1658298568 OR se
               rial = 1649680536 OR serial = 1649819672 OR serial = 1654964456 OR serial = 1649729552 OR seri
               al = 1656103144 OR serial = 1655460032 OR serial = 1656111336 OR serial = 1654669360))
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=multiKSQ[16]@2000
    \_index=bySerial
  optimization                                                                                 0.026
  optimization                                                                                 0.588
  backend-query                                                       16                      18.813
    \_query=bySerial:multiKSQ[16]@2000
    \_limit=2000
JanusGraphVertexStep(IN,[assembled],vertex)                           73          73           6.521     8.66
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_multi=true
    \_vertices=16
  optimization                                                                                 0.154
  backend-query                                                       73                       5.310
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
JanusGraphVertexStep(IN,[assembled],edge)                           2578        2578          20.170    26.77
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_multi=true
    \_vertices=59
  optimization                                                                                 0.032
  backend-query                                                     2578                      10.266
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
TraversalFilterStep([EdgeVertexStep(OUT), Profi...                  2578        2578          21.824    28.97
  EdgeVertexStep(OUT)                                               2578        2578           4.776
  IsStep(neq(a))                                                                               6.172
EdgeVertexStep(OUT)                                                 2578        2578           6.842     9.08
                                            >TOTAL                     -           -          75.338        -


3. Results I want to get.
----------------------------------------------------------------------
g.V().has('serial', within('1654145144','1648418968','1652445288','1654952168','1653379120','1654325440','1653383216','1658298568','1649680536','1649819672','1654964456','1649729552','1656103144','1655460032','1656111336','1654669360')).as('a').repeat(inE('assembled').as('b').outV().as('c').simplePath()).emit().select('a').id().as('parent').select('b').values('work_date').as('work_date').select('c').values('serial').as('child').select('parent','child','work_date').order().by('parent').by('child').by('work_date').profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[serial.within([1654145144, 1...                    16          16          24.028     4.95
    \_condition=((serial = 1654145144 OR serial = 1648418968 OR serial = 1652445288 OR serial = 1654952168 OR
               serial = 1653379120 OR serial = 1654325440 OR serial = 1653383216 OR serial = 1658298568 OR se
               rial = 1649680536 OR serial = 1649819672 OR serial = 1654964456 OR serial = 1649729552 OR seri
               al = 1656103144 OR serial = 1655460032 OR serial = 1656111336 OR serial = 1654669360))
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=multiKSQ[16]@2000
    \_index=bySerial
  optimization                                                                                 0.074
  optimization                                                                                 1.256
  backend-query                                                       16                     312.583
    \_query=bySerial:multiKSQ[16]@2000
    \_limit=2000
RepeatStep([JanusGraphVertexStep(IN,[assembled]...                  2925        2925         272.924    56.26
  JanusGraphVertexStep(IN,[assembled],edge)@[b]                     2925        2925         223.728
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_multi=true
    \_vertices=9
    optimization                                                                               0.203
    backend-query                                                      5                       1.557
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.020
    backend-query                                                    161                       2.356
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.125
    backend-query                                                      9                      25.853
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.023
    backend-query                                                      8                       2.168
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.024
    backend-query                                                      0                       1.808
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      5                       1.354
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.024
    backend-query                                                    161                       1.989
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.040
    backend-query                                                      9                       3.490
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      0                       2.231
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.061
    backend-query                                                      5                       1.877
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.027
    backend-query                                                    161                       4.645
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.056
    backend-query                                                     10                       2.554
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.073
    backend-query                                                      9                       4.274
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      0                       1.199
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      5                       1.165
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.025
    backend-query                                                    161                       8.010
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.032
    backend-query                                                      9                       1.542
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.032
    backend-query                                                      4                       5.402
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.038
    backend-query                                                      5                       4.173
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.029
    backend-query                                                    161                       4.113
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.056
    backend-query                                                      9                       1.617
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.035
    backend-query                                                      0                       1.517
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.044
    backend-query                                                      5                       1.522
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.045
    backend-query                                                    161                       1.985
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.029
    backend-query                                                      9                       1.435
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                      0                       1.034
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.021
    backend-query                                                      3                       1.108
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.024
    backend-query                                                    161                       1.785
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.036
    backend-query                                                      9                       7.190
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.032
    backend-query                                                      8                      12.321
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.044
    backend-query                                                      0                       1.926
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.032
    backend-query                                                      5                       1.782
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                    161                       3.398
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.031
    backend-query                                                      9                       1.412
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      0                       1.212
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.035
    backend-query                                                      5                       1.283
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                    161                       2.149
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.035
    backend-query                                                      9                       1.415
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.025
    backend-query                                                      1                       1.214
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.025
    backend-query                                                      3                       1.313
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.027
    backend-query                                                    161                       2.004
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.038
    backend-query                                                      9                       8.265
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.031
    backend-query                                                      0                       1.718
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                      5                       1.489
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.029
    backend-query                                                    161                       2.066
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.029
    backend-query                                                      9                       1.361
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.024
    backend-query                                                      2                       1.454
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      5                       1.234
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.025
    backend-query                                                    161                       1.819
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.027
    backend-query                                                      9                       1.361
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      0                       1.136
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                      5                       1.265
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.029
    backend-query                                                    161                      10.425
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.040
    backend-query                                                      9                       2.437
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.050
    backend-query                                                      0                       1.462
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.049
    backend-query                                                      5                       2.208
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                    163                       2.415
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.035
    backend-query                                                      9                       1.252
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.027
    backend-query                                                      0                       1.164
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.032
    backend-query                                                      4                       1.335
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                    161                       1.944
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.028
    backend-query                                                      9                       1.473
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.026
    backend-query                                                      0                       1.114
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.025
    backend-query                                                      3                       1.279
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.025
    backend-query                                                    161                       1.867
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.033
    backend-query                                                      9                       1.463
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.027
    backend-query                                                      0                       1.169
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
  EdgeVertexStep(OUT)@[c]                                           2925        2925           7.733
  PathFilterStep(simple)                                            2925        2925          10.508
  JanusGraphMultiQueryStep(RepeatEndStep)                           2925        2925          14.827
  RepeatEndStep                                                     2925        2925           9.754
SelectOneStep(last,a)                                               2925        2925           8.340     1.72
IdStep@[parent]                                                     2925        2925           7.347     1.51
SelectOneStep(last,b)                                               2925        2925           8.690     1.79
JanusGraphPropertiesStep([work_date],value)@[wo...                  2925        2925          35.051     7.22
SelectOneStep(last,c)                                               2925        2925           9.512     1.96
JanusGraphPropertiesStep([serial],value)@[child]                    2925        2925          79.337    16.35
    \_condition=type[serial]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@811c505d
    \_multi=true
    \_vertices=302
  optimization                                                                                 0.044
  backend-query                                                      302                      53.962
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@811c505d
SelectStep(last,[parent, child, work_date])                         2925        2925          10.705     2.21
OrderGlobalStep([[value(parent), asc], [value(c...                  2925        2925          29.210     6.02
                                            >TOTAL                     -           -         485.149        -


Best regards,
Manabu

2020年11月26日木曜日 16:07:27 UTC+9 HadoopMarc:
Hi Manabu,

OK, I think for this graph structure your initial query is fine for getting the right output results. Still, to better understand the impact on the performance of using sack() you might want to split up your query during experimentation:
  1. g.V().has('serial',within('XXXXXX','YYYYYY')).inE('assembled').outV()
  2. g.V().has('serial',within('XXXXXX','YYYYYY')).as('a').in('assembled').inE('assembled').where(outV(), neq('a')).outV()            // query not tested

Note that I did not use the SimplePath() step, but because it probably precludes the bulking after adding appropriate sack() steps.
If you want others to step in for getting the sack() steps right, please provide the gremlin steps to create your sample graph and the query you have already tried with query output and profile() output.

Best wishes,      Marc


Op donderdag 26 november 2020 om 00:29:33 UTC+1 schreef Manabu Kotani:
Hi Marc,

Sorry, I forgot an attachment (Image of tree structure).

Relationships between vertices and edges are like below.
(Label:item, serial:A)<--[Label:assembled, work_date:2020-11-24]--(Label:item, serial:B)
(Label:item, serial:A)<--[Label:assembled, work_date:2020-11-25]--(Label:item, serial:C)  
(Label:item, serial:B)<--[Label:assembled, work_date:2020-11-23]--(Label:item, serial:D)    
(Label:item, serial:B)<--[Label:assembled, work_date:2020-11-22]--(Label:item, serial:E)      
(Label:item, serial:C)<--[Label:assembled, work_date:2020-11-21]--(Label:item, serial:E)        
(Label:item, serial:C)<--[Label:assembled, work_date:2020-11-20]--(Label:item, serial:F)          



Best regards,
Manabu

2020年11月25日水曜日 19:55:54 UTC+9 HadoopMarc:
Hi Manabu,

What edge are present between vertices A,B,C,D,E,F?

If there are only edges A-B, A-C, A-D, A-E, A-F, you do not need repeat().

Best wishes,    Marc


Op woensdag 25 november 2020 om 09:22:34 UTC+1 schreef Manabu Kotani:
Hi Marc,

Thank you for your quick reply.

Sorry for the lack of my explanation.
I have a graph like below. (There are 3 levels in this figure, but not necessarily 3 levels.)


When query by "A" for property "serial", then I would like to get results like these.
1. A, B, 2020-11-24
2. A, C, 2020-11-25
3. A, D, 2020-11-23
4. A, E, 2020-11-21
5. A, E, 2020-11-22
6. A, F, 2020-11-20

In this situation, how shoud I use until() step?

Sorry for my low comprehension, I've just started to learn Gremlin.

Best regards,
Manabu

2020年11月25日水曜日 15:46:35 UTC+9 HadoopMarc:
Hi Manabu,

repeat()/simplePath()/emit() can have valid uses, although normally you combine it with the times() or until() step to limit the number of repeats. The profile from your query suggests that the repeat step never takes effect, that is, each traversal takes only a single step from parent to child. The repeat step is not wrong in itself, but if it is not necessary you do not want it to be there if you do not know its impact on performance.

Best wishes,    Marc

Op dinsdag 24 november 2020 om 08:43:36 UTC+1 schreef Manabu Kotani:
Hi Marc,

Thank you for your reply.

I'm reading ref docs that you referred about sack()/barrier(). But, I've not able to understand yet.

One question.
What means this you advised? repeat()/simplePath()/emit() steps should not be used?

  • in the current traversal the repeat(), simplePath() and emit() steps have no effect if the children do not assemble children themselves. So you can leave these steps out for clarity and to be sure that they do not influence the janusgraph execution plan
Best regards,
Manabu

2020年11月21日土曜日 20:13:28 UTC+9 HadoopMarc:
Hi Manabu,

Without knowing if the considerations below will really help, you may try the following:
Best wishes,    Marc

Op donderdag 19 november 2020 om 02:37:48 UTC+1 schreef Manabu Kotani:
Hi All,

I'm testing traversal query performance.
My query (please see below) takes about 1.8sec.

Is there solution for improve performance (faster than 1.8sec)?
I hope that takes less than 500ms.

1.Environment:
JanusGraph (0.5.2) + Cassandra (3.11.0) on Docker Desktop (Windows)

2.Schema:
------------------------------------------------------------------------------------------------
Vertex Label Name              | Partitioned | Static                                             |
---------------------------------------------------------------------------------------------------
item                           | false       | false                                              |
---------------------------------------------------------------------------------------------------
Edge Label Name                | Directed    | Unidirected | Multiplicity                         |
---------------------------------------------------------------------------------------------------
assembled                      | true        | false       | MULTI                                |
---------------------------------------------------------------------------------------------------
Property Key Name              | Cardinality | Data Type                                          |
---------------------------------------------------------------------------------------------------
serial                         | SINGLE      | class java.lang.String                             |
work_date                      | SINGLE      | class java.util.Date                               |
---------------------------------------------------------------------------------------------------
Vertex Index Name              | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
bySerial                       | Composite   | false     | internalindex  | serial:       ENABLED |
---------------------------------------------------------------------------------------------------
Edge Index (VCI) Name          | Type        | Unique    | Backing        | Key:           Status |
---------------------------------------------------------------------------------------------------
byWorkDate                     | Composite   | false     | internalindex  | work_date:    ENABLED |
---------------------------------------------------------------------------------------------------
Relation Index                 | Type        | Direction | Sort Key       | Order    |     Status |
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------  

3.Query:
g.V().has('serial',within('XXXXXX','YYYYYY',....<- 100 search keys).as('a')
.repeat(inE('assembled').as('b').outV().as('c').simplePath())
.emit()
.select('a').values('serial').as('parent')
.select('b').values('work_date').as('work_date')
.select('c').values('serial').as('child')
.select('parent','child','work_date')
.order().by('parent').by('child').by('work_date')
----------------------------------------------------------------------------------------------------------- 
 
4.Query Profile:
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[serial.within([XXXXXX...                   100         100         159.582     8.89
    \_condition=((serial = XXXXXX OR serial = YYYYYY OR .... <- 100 search keys))
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=multiKSQ[100]@2000
    \_index=bySerial
  optimization                                                                                 0.018
  optimization                                                                                 6.744
  backend-query                                                      100                    1074.225
    \_query=bySerial:multiKSQ[100]@2000
    \_limit=2000
RepeatStep([JanusGraphVertexStep(IN,[assembled]...                 20669       20669         857.001    47.74
  JanusGraphVertexStep(IN,[assembled],edge)@[b]                    20669       20669         633.529
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_multi=true
    \_vertices=204
    optimization                                                                               0.477
    backend-query                                                    228                       2.076
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.150
    backend-query                                                      0                      43.366
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.093
    backend-query                                                    229                       1.978
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.107
    backend-query                                                      0                      32.738
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.111
    backend-query                                                    229                       1.577
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.107
    backend-query                                                      0                      17.827
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.085
    backend-query                                                    229                       1.517
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.108
    backend-query                                                      0                       5.729
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.071
    backend-query                                                    228                       1.993
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.083
    backend-query                                                      0                       3.335
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.150
    backend-query                                                    229                       1.890
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.137
    backend-query                                                      0                      32.593
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.110
    backend-query                                                    229                       2.253
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.069
    backend-query                                                    230                       1.624
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                      0                      12.797
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.116
    backend-query                                                    229                       1.579
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.090
    backend-query                                                      0                       5.764
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.107
    backend-query                                                    229                       1.651
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.134
    backend-query                                                      0                      22.327
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.074
    backend-query                                                    229                       1.756
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.075
    backend-query                                                      0                      11.145
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.069
    backend-query                                                    229                       1.947
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.086
    backend-query                                                      0                       3.727
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.100
    backend-query                                                    116                       1.492
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.085
    backend-query                                                      0                      27.159
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.132
    backend-query                                                    229                       1.524
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.100
    backend-query                                                      0                       7.173
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.075
    backend-query                                                    230                       1.880
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.114
    backend-query                                                      0                       3.696
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.085
    backend-query                                                    228                       1.645
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.143
    backend-query                                                      0                       2.924
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.105
    backend-query                                                    229                       2.010
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.316
    backend-query                                                      0                       3.806
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.095
    backend-query                                                    230                       1.854
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.185
    backend-query                                                    229                       1.936
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.099
    backend-query                                                      0                       2.135
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                    231                       1.479
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.067
    backend-query                                                      0                       5.907
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.069
    backend-query                                                      1                       1.129
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.109
    backend-query                                                      0                       1.069
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.082
    backend-query                                                    231                       1.245
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.072
    backend-query                                                      0                       1.175
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.064
    backend-query                                                    229                       1.308
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.078
    backend-query                                                      0                       7.058
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.145
    backend-query                                                    231                       1.655
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.115
    backend-query                                                      0                       3.946
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.067
    backend-query                                                    117                       1.231
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.063
    backend-query                                                      0                      11.856
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.065
    backend-query                                                    230                       1.606
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.072
    backend-query                                                      0                       6.973
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                    229                       1.445
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.088
    backend-query                                                    230                       1.836
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.098
    backend-query                                                      0                       2.552
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.088
    backend-query                                                    116                       1.450
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.060
    backend-query                                                      0                       4.072
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.062
    backend-query                                                    229                       1.421
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.058
    backend-query                                                      0                       2.342
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.058
    backend-query                                                    229                       0.999
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                      0                       1.847
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.063
    backend-query                                                    229                       1.171
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.064
    backend-query                                                      0                       0.999
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.051
    backend-query                                                    228                       0.991
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                      0                       2.107
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.215
    backend-query                                                    116                       1.678
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.069
    backend-query                                                    229                       1.578
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.081
    backend-query                                                      0                       3.649
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.096
    backend-query                                                    229                       1.619
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.066
    backend-query                                                    228                       1.549
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                    116                       1.610
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.154
    backend-query                                                    228                       1.746
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.092
    backend-query                                                      0                       2.958
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.093
    backend-query                                                    232                       1.698
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.143
    backend-query                                                    229                       1.719
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.081
    backend-query                                                      0                       2.809
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.065
    backend-query                                                    229                       1.410
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.082
    backend-query                                                    229                       1.458
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.109
    backend-query                                                    228                       1.651
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.066
    backend-query                                                    228                       1.417
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.111
    backend-query                                                    117                       1.536
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.188
    backend-query                                                      0                       1.660
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.132
    backend-query                                                    229                       2.361
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.110
    backend-query                                                      0                       2.384
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.140
    backend-query                                                    229                       1.680
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.067
    backend-query                                                    230                       1.342
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                      0                       3.129
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.118
    backend-query                                                    231                       1.397
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.169
    backend-query                                                      0                       5.665
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.114
    backend-query                                                    116                       1.780
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.128
    backend-query                                                      0                       2.316
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.108
    backend-query                                                    229                       1.521
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.083
    backend-query                                                    231                       1.508
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.074
    backend-query                                                      0                       2.327
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.092
    backend-query                                                    116                       1.509
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.285
    backend-query                                                      0                       2.007
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.079
    backend-query                                                    116                       1.245
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.134
    backend-query                                                    230                       1.521
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.092
    backend-query                                                      1                       1.278
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.064
    backend-query                                                      0                       1.104
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.076
    backend-query                                                    231                       1.287
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.079
    backend-query                                                    229                       1.768
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.098
    backend-query                                                      0                       2.570
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.110
    backend-query                                                    116                       1.489
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.061
    backend-query                                                      0                       1.756
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.055
    backend-query                                                    229                       1.133
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.060
    backend-query                                                    116                       1.241
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.056
    backend-query                                                      0                       2.435
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.056
    backend-query                                                    228                       1.099
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.061
    backend-query                                                      0                       1.017
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.080
    backend-query                                                    229                       1.217
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.065
    backend-query                                                    230                       1.448
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.065
    backend-query                                                    229                       1.546
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.079
    backend-query                                                    230                       1.955
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.165
    backend-query                                                      0                       3.284
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.102
    backend-query                                                    229                       1.936
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.081
    backend-query                                                      0                       4.640
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.072
    backend-query                                                    229                       1.384
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.062
    backend-query                                                      0                       2.224
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.088
    backend-query                                                    116                       1.419
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.069
    backend-query                                                      0                       2.289
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                    231                       1.474
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.071
    backend-query                                                    229                       1.646
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.072
    backend-query                                                      0                       1.408
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.068
    backend-query                                                    230                       1.974
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.090
    backend-query                                                    229                       1.923
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.151
    backend-query                                                    230                       2.211
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.074
    backend-query                                                    230                       1.234
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.059
    backend-query                                                      0                       1.695
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.125
    backend-query                                                    230                       1.199
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.064
    backend-query                                                      0                       1.089
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.057
    backend-query                                                    116                       1.807
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.085
    backend-query                                                      0                       1.299
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.074
    backend-query                                                    228                       1.397
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.081
    backend-query                                                    228                       1.776
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.079
    backend-query                                                      0                       1.980
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.101
    backend-query                                                    229                       1.571
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                    231                       1.483
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.064
    backend-query                                                      0                       2.260
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.060
    backend-query                                                    230                       1.471
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.070
    backend-query                                                    232                       1.305
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.060
    backend-query                                                    229                       1.246
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.063
    backend-query                                                    229                       1.093
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.053
    backend-query                                                    229                       1.420
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.062
    backend-query                                                    226                       1.596
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.145
    backend-query                                                      0                       2.730
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.059
    backend-query                                                    229                       1.550
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.076
    backend-query                                                    231                       1.622
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.058
    backend-query                                                    117                       1.224
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.108
    backend-query                                                      0                       2.025
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.062
    backend-query                                                    230                       1.251
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.058
    backend-query                                                    230                       1.223
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.068
    backend-query                                                    116                       1.224
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.051
    backend-query                                                      0                       0.937
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.045
    backend-query                                                    116                       1.597
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.058
    backend-query                                                    228                       1.595
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.063
    backend-query                                                      0                       3.238
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.058
    backend-query                                                    229                       1.573
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.078
    backend-query                                                    231                       1.894
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.092
    backend-query                                                    230                       1.717
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    optimization                                                                               0.061
    backend-query                                                    231                       1.302
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
  EdgeVertexStep(OUT)@[c]                                          20669       20669          39.223
  PathFilterStep(simple)                                           20669       20669          44.905
  JanusGraphMultiQueryStep(RepeatEndStep)                          20669       20669          65.528
  RepeatEndStep                                                    20669       20669          39.443
SelectOneStep(last,a)                                              20669       20669          44.574     2.48
JanusGraphPropertiesStep([serial],value)@[parent]                  20669       20669          92.515     5.15
    \_condition=type[serial]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@811c505d
    \_multi=true
    \_vertices=100
  optimization                                                                                 0.090
  backend-query                                                      100                      12.807
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@811c505d
SelectOneStep(last,b)                                              20669       20669          41.753     2.33
JanusGraphPropertiesStep([work_date],value)@[wo...                 20669       20669          98.648     5.50
SelectOneStep(last,c)                                              20669       20669          41.674     2.32
JanusGraphPropertiesStep([serial],value)@[child]                   20669       20669         246.094    13.71
    \_condition=type[serial]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@811c505d
    \_multi=true
    \_vertices=1392
  optimization                                                                                 0.060
  backend-query                                                     1392                     136.281
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@811c505d
SelectStep(last,[parent, child, work_date])                        20669       20669          49.139     2.74
OrderGlobalStep([[value(parent), asc], [value(c...                 20669       20669         164.034     9.14
                                            >TOTAL                     -           -        1795.018        -
-----------------------------------------------------------------------------------------------------------

Sorry for my poor English.
Thanks,
Manabu


Re: Profile() seems inconsisten with System.currentTimeMillis

HadoopMarc <bi...@...>
 

In the mean time I found that the difference between profile() and currentTimeMillis can be much larger. Apparently, the profile() step takes into account that for real queries, vertices are not present in the database cache and assumes some time duration to retrieve a vertex or properties from the backend. Is there any documentation on these assumptions?

Best wishes,    Marc

Op vrijdag 11 december 2020 om 09:58:21 UTC+1 schreef HadoopMarc:


Hi,

Can anyone explain why the total duration displayed by the profile() step is more than twice as large as the time difference clocked with System.currentTimeMillis?
see below, For those who wonder, the query without profile() also takes about 300 msec.

Thanks,      Marc

gremlin> start = System.currentTimeMillis()
==>1607676127027
gremlin> g.V().has('serial', within('1654145144','1648418968','1652445288','1654952168','1653379120', '1654325440','1653383216','1658298568','1649680536','1649819672','1654964456','1649729552', '1656103144','1655460032','1656111336','1654669360')).inE('assembled').outV().profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[serial.within([1654145144, 1...                    16          16           0,486    59,26
    \_condition=((serial = 1654145144 OR serial = 1648418968 OR serial = 1652445288 OR serial = 1654952168 OR
               serial = 1653379120 OR serial = 1654325440 OR serial = 1653383216 OR serial = 1658298568 OR se
               rial = 1649680536 OR serial = 1649819672 OR serial = 1654964456 OR serial = 1649729552 OR seri
               al = 1656103144 OR serial = 1655460032 OR serial = 1656111336 OR serial = 1654669360))
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=multiKSQ[16]@2000
    \_index=bySerial
  optimization                                                                                 0,009
  optimization                                                                                 0,267
JanusGraphVertexStep(IN,[assembled],vertex)                           73          73           0,334    40,74
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_vertices=1
  optimization                                                                                 0,037
  optimization                                                                                 0,008
  optimization                                                                                 0,005
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,017
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
                                            >TOTAL                     -           -           0,820        -
gremlin> System.currentTimeMillis() - start
==>322



Profile() seems inconsisten with System.currentTimeMillis

HadoopMarc <bi...@...>
 


Hi,

Can anyone explain why the total duration displayed by the profile() step is more than twice as large as the time difference clocked with System.currentTimeMillis?
see below, For those who wonder, the query without profile() also takes about 300 msec.

Thanks,      Marc

gremlin> start = System.currentTimeMillis()
==>1607676127027
gremlin> g.V().has('serial', within('1654145144','1648418968','1652445288','1654952168','1653379120', '1654325440','1653383216','1658298568','1649680536','1649819672','1654964456','1649729552', '1656103144','1655460032','1656111336','1654669360')).inE('assembled').outV().profile()
==>Traversal Metrics
Step                                                               Count  Traversers       Time (ms)    % Dur
=============================================================================================================
JanusGraphStep([],[serial.within([1654145144, 1...                    16          16           0,486    59,26
    \_condition=((serial = 1654145144 OR serial = 1648418968 OR serial = 1652445288 OR serial = 1654952168 OR
               serial = 1653379120 OR serial = 1654325440 OR serial = 1653383216 OR serial = 1658298568 OR se
               rial = 1649680536 OR serial = 1649819672 OR serial = 1654964456 OR serial = 1649729552 OR seri
               al = 1656103144 OR serial = 1655460032 OR serial = 1656111336 OR serial = 1654669360))
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=multiKSQ[16]@2000
    \_index=bySerial
  optimization                                                                                 0,009
  optimization                                                                                 0,267
JanusGraphVertexStep(IN,[assembled],vertex)                           73          73           0,334    40,74
    \_condition=type[assembled]
    \_orders=[]
    \_isFitted=true
    \_isOrdered=true
    \_query=org.janusgraph.diskstorage.keycolumnvalue.SliceQuery@812bd43d
    \_vertices=1
  optimization                                                                                 0,037
  optimization                                                                                 0,008
  optimization                                                                                 0,005
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,017
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
  optimization                                                                                 0,004
                                            >TOTAL                     -           -           0,820        -
gremlin> System.currentTimeMillis() - start
==>322



Re: Running OLAP on HBase with SparkGraphComputer fails with Error Container killed by YARN for exceeding memory limits

HadoopMarc <bi...@...>
 

Hi Roy,

I think I would first check whether the skew is absent if you count the rows reading the HBase table directly from spark (so, without using janusgraph), e.g.:

https://stackoverflow.com/questions/42019905/how-to-use-newapihadooprdd-spark-in-java-to-read-hbase-data

If this works all right, than you know that somehow in janusgraph HBaseInputFormat the mappers do not get the right key ranges to read from.

I also though about the storage.hbase.region-count property of janusgraph-hbase. If you would specify this at 40 while creating the graph, janusgraph-hbase would create many small regions that will be compacted by HBase later on. But maybe this creates a different structure in the row keys that can be leveraged by the hbase.mapreduce.tableinput.mappers.per.region.

Best wishes,     Marc


Op woensdag 9 december 2020 om 17:16:35 UTC+1 schreef Roy Yu:

Hi Marc, 

The parameter  hbase.mapreduce.tableinput.mappers.per.region  can be effective. I set it to 40, and there are 40 tasks processing every region. But here comes the new promblem--the data skew. I use g.E().count() to count all the edges of the graph. During counting one region, one spark task containing all 2.6GB data, while other 39 tasks containing 0 data. The task failed again.  I checked my data. There are some vertices which have more 1 million incident edges.  So I tried to solve this promblem using vertex cut(https://docs.janusgraph.org/advanced-topics/partitioning/), my graph schema is something like  [mgmt.makeVertexLabel('product').partition().make() ]. But when I using MR to load data to the new graph, it consumed more than 10 times when the attemp without using partition(), from the hbase table detail page, I found the data loading process was busy reading data from  and writing data to the first region. The first region became the hot spot. I guess it relates to vertex ids. Could help me again?

On Tuesday, December 8, 2020 at 3:13:42 PM UTC+8 HadoopMarc wrote:
Hi Roy,

As I mentioned, I did not keep up with possibly new janusgraph-hbase features. From the HBase source, I see that HBase now has a "hbase.mapreduce.tableinput.mappers.per.region" config parameter.


It should not be too difficult to adapt the janusgraph HBaseInputFormat to leverage this feature (or maybe it even works without change???).

Best wishes,

Marc

Op dinsdag 8 december 2020 om 04:21:19 UTC+1 schreef Roy Yu:
you seem to run on cloud infra that reduces your requested 40 Gb to 33 Gb (see https://databricks.com/session_na20/running-apache-spark-on-kubernetes-best-practices-and-pitfalls). Fact of life. 
---------------------
Sorry Marc I misled you. Error Message was generated when I set spark.executor.memory to 30G, when it failed, I increased spark.executor.memory  to 40G, it failed either. I felt desperate and come here to ask for help
On Tuesday, December 8, 2020 at 10:35:19 AM UTC+8 Roy Yu wrote:
Hi Marc

Thanks for your immediate response.
I've tried to set spark.yarn.executor.memoryOverhead=10G and re-run the task, and it stilled failed. From the spark task UI, I saw 80% of processing time is Full GC time. As you said, 2.6GB(GZ compressed) exploding is  my root cause. Now I'm trying to reduce my region size to 1GB, if that will still fail, I'm gonna config the hbase hfile not using compressed format.
This was my first time running janusgraph OLAP, and I think this is a common promblom, as HBase region size 2.6GB(compressed) is not large, 20GB is very common in our production. If the community dose not solve the promblem, the Janusgraph HBase based OLAP solution cannot be adopted by other companies either.

On Tuesday, December 8, 2020 at 12:40:40 AM UTC+8 HadoopMarc wrote:
Hi Roy,

There seem to be three things bothering you here:
  1. you did not specify spark.yarn.executor.memoryOverhead, as the exception message says. Easily solved.
  2. you seem to run on cloud infra that reduces your requested 40 Gb to 33 Gb (see https://databricks.com/session_na20/running-apache-spark-on-kubernetes-best-practices-and-pitfalls). Fact of life.
  3. the janusgraph HBaseInputFormat use sentire HBase regions as hadoop partitions, which are fed into spark tasks. The 2.6Gb region size is for compressed binary data which explodes when expanded into java objects. This is your real problem.
I did not follow the latest status of janusgraph-hbase features for the HBaseInputFormat, but you have to somehow use spark with smaller partitions than an entire HBase region.
A long time ago, I had success with skipping the HBaseInputFormat and have spark executors connect to JanusGraph themselves. That is not a quick solution, though.

Best wishes,

Marc

Op maandag 7 december 2020 om 14:10:55 UTC+1 schreef Roy Yu:
Error message:
ExecutorLostFailure (executor 1 exited caused by one of the running tasks) Reason: Container killed by YARN for exceeding memory limits. 33.1 GB of 33 GB physical memory used. Consider boosting spark.yarn.executor.memoryOverhead or disabling yarn.nodemanager.vmem-check-enabled because of YARN-4714. 

 graph conifg:
spark.executor.extraJavaOptions=-XX:+UseG1GC -XX:MaxGCPauseMillis=500 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/mnt/data_1/log/spark2/gc-spark%p.log
spark.executor.cores=1
spark.executor.memory=40960m
spark.executor.instances=3

Region info:
hdfs dfs -du -h /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc
67     134    /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/.regioninfo
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/.tmp
2.6 G  5.1 G  /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/e
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/f
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/g
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/h
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/i
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/l
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/m
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/recovered.edits
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/s
0      0      /apps/hbase/data/data/default/ky415/f069fafb3ee51d6a2e5bc2377b468bcc/t
root@~$

Anybody who can help me?


Re: Error when running JanusGraph with YARN and CQL

HadoopMarc <bi...@...>
 

Hi Varun,

Good job. However, your last solution will only work with everything running on a single machine. So, indeed, there is something wrong with the contents of spark-gremlin.zip or with the way it is put in the executor's local working directory. Note that you already put /Users/my_comp/Downloads/janusgraph-0.5.2/lib/janusgraph-cql-0.5.2.jar explicitly on the executor classpath while it should have been available already through ./spark-gremlin.zip/*

O, I think I see now what is different. You have used spark.yarn.dist.archives, while the TinkerPop recipes use spark.yarn.archive. They behave differently in yes/no extracting the jars from the zip. I guess either can be used, provided it is done consistently. You can use the environment tab in Spark web UI to inspect how things are picked up by spark.

Best wishes,    Marc

Op donderdag 10 december 2020 om 20:23:32 UTC+1 schreef Varun Ganesh:

Answering my own question. I was able fix the above error and successfully run the count job after explicitly adding /Users/my_comp/Downloads/janusgraph-0.5.2/lib/* to spark.executor.extraClassPath

But I am not yet sure as to why that was needed. I had assumed that adding spark-gremlin.zip to the path would have provided the required dependencies.

On Thursday, December 10, 2020 at 1:00:24 PM UTC-5 Varun Ganesh wrote:
An update on this, I tried setting the env var below:

export HADOOP_GREMLIN_LIBS=$GREMLIN_HOME/lib

After doing this I was able to successfully run the tinkerpop-modern.kryo example from the Recipes documentation
(though the guide at http://yaaics.blogspot.com/2017/07/configuring-janusgraph-for-spark-yarn.html explicitly asks us to ignore this)

Unfortunately, it is still not working with CQL. But the error is now different. Please see below:

12:46:33 ERROR org.apache.spark.scheduler.TaskSetManager - Task 3 in stage 0.0 failed 4 times; aborting job
org.apache.spark.SparkException: Job aborted due to stage failure: Task 3 in stage 0.0 failed 4 times, most recent failure: Lost task 3.3 in stage 0.0 (TID 9, 192.168.1.160, executor 2): java.lang.NoClassDefFoundError: org/janusgraph/hadoop/formats/util/HadoopInputFormat
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
... (skipping)
Caused by: java.lang.ClassNotFoundException: org.janusgraph.hadoop.formats.util.HadoopInputFormat
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 130 more

Is there some additional dependency that I may need to add?

Thanks in advance!
On Wednesday, December 9, 2020 at 11:49:29 PM UTC-5 Varun Ganesh wrote:
Hello,

I am trying to run SparkGraphComputer on a JanusGraph backed by Cassandra and ElasticSearch. I have previously verified that I am able to run SparkGraphComputer on a local Spark standalone cluster.

I am now trying to run it on YARN. I have a local YARN cluster running and I have verified that it can run Spark jobs.

I followed the following links:

And here is my read-cql-yarn.properties file:
gremlin.graph=org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph
gremlin.hadoop.graphReader=org.janusgraph.hadoop.formats.cql.CqlInputFormat
gremlin.hadoop.graphWriter=org.apache.hadoop.mapreduce.lib.output.NullOutputFormat

gremlin.hadoop.jarsInDistributedCache=true
gremlin.hadoop.inputLocation=none
gremlin.hadoop.outputLocation=output
gremlin.spark.persistContext=true

#
# JanusGraph Cassandra InputFormat configuration
#
# These properties defines the connection properties which were used while write data to JanusGraph.
janusgraphmr.ioformat.conf.storage.backend=cql
# This specifies the hostname & port for Cassandra data store.
janusgraphmr.ioformat.conf.storage.hostname=127.0.0.1
janusgraphmr.ioformat.conf.storage.port=9042
# This specifies the keyspace where data is stored.
janusgraphmr.ioformat.conf.storage.cql.keyspace=janusgraph
# This defines the indexing backend configuration used while writing data to JanusGraph.
janusgraphmr.ioformat.conf.index.search.backend=elasticsearch
janusgraphmr.ioformat.conf.index.search.hostname=127.0.0.1
# Use the appropriate properties for the backend when using a different storage backend (HBase) or indexing backend (Solr).

#
# Apache Cassandra InputFormat configuration
#
cassandra.input.partitioner.class=org.apache.cassandra.dht.Murmur3Partitioner
cassandra.input.widerows=true

#
# SparkGraphComputer Configuration
#
spark.master=yarn
spark.submit.deployMode=client
spark.executor.memory=1g

spark.yarn.dist.archives=/tmp/spark-gremlin.zip
spark.yarn.dist.files=/Users/my_comp/Downloads/janusgraph-0.5.2/lib/janusgraph-cql-0.5.2.jar
spark.yarn.appMasterEnv.CLASSPATH=/Users/my_comp/Downloads/hadoop-2.7.2/etc/hadoop:./spark-gremlin.zip/*
spark.executor.extraClassPath=/Users/my_comp/Downloads/hadoop-2.7.2/etc/hadoop:/Users/my_comp/Downloads/janusgraph-0.5.2/lib/janusgraph-cql-0.5.2.jar:./spark-gremlin.zip/*

spark.driver.extraLibraryPath=/Users/my_comp/Downloads/hadoop-2.7.2/lib/native:/Users/my_comp/Downloads/hadoop-2.7.2/lib/native/Linux-amd64-64
spark.executor.extraLibraryPath=/Users/my_comp/Downloads/hadoop-2.7.2/lib/native:/Users/my_comp/Downloads/hadoop-2.7.2/lib/native/Linux-amd64-64

spark.serializer=org.apache.spark.serializer.KryoSerializer
spark.kryo.registrator=org.janusgraph.hadoop.serialize.JanusGraphKryoRegistrator

After a bunch of trial and error, I was able to get it to a point where I see containers starting up on my YARN Resource manager UI (port 8088)

Here is the code I am running (it's a simple count):
gremlin> graph = GraphFactory.open('conf/hadoop-graph/read-cql-yarn.properties')
==>hadoopgraph[cqlinputformat->nulloutputformat]
gremlin> g = graph.traversal().withComputer(SparkGraphComputer)
==>graphtraversalsource[hadoopgraph[cqlinputformat->nulloutputformat], sparkgraphcomputer]
gremlin> g.V().count()

However I am encountering the following failure:
18:49:03 ERROR org.apache.spark.scheduler.TaskSetManager - Task 2 in stage 0.0 failed 4 times; aborting job
org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 0.0 failed 4 times, most recent failure: Lost task 2.3 in stage 0.0 (TID 10, 192.168.1.160, executor 1): java.lang.IllegalStateException: unread block data
at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2862)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1682)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2366)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2290)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2148)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1647)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:483)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:441)
at org.apache.spark.serializer.JavaDeserializationStream.readObject(JavaSerializer.scala:75)
at org.apache.spark.serializer.JavaSerializerInstance.deserialize(JavaSerializer.scala:114)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:370)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Would really appricate it if someone could shed some light on this error and advise on next steps!

Thank you!

1241 - 1260 of 6651