Azure Gremlin边缘遍历的RU成本高得令人怀疑(Out()步)
我有一个奇怪的问题,在一些边缘做一个out操作会导致RU成本增加三倍。希望有人能帮助我阐明为什么+我能做些什么来缓解它 我在CosmosDB中有一个图,其中有两种类型的顶点标签:“Profile”和“Score”。通过“ProfileHasAggregatedScore”边,每个轮廓都有0或1个分数顶点。partitionKey是配置文件的ID 如果我进行以下查询,RU当前为:Azure Gremlin边缘遍历的RU成本高得令人怀疑(Out()步),azure,azure-cosmosdb,gremlin,azure-cosmosdb-gremlinapi,Azure,Azure Cosmosdb,Gremlin,Azure Cosmosdb Gremlinapi,我有一个奇怪的问题,在一些边缘做一个out操作会导致RU成本增加三倍。希望有人能帮助我阐明为什么+我能做些什么来缓解它 我在CosmosDB中有一个图,其中有两种类型的顶点标签:“Profile”和“Score”。通过“ProfileHasAggregatedScore”边,每个轮廓都有0或1个分数顶点。partitionKey是配置文件的ID 如果我进行以下查询,RU当前为: g.V().hasLabel('Profile').out('ProfileHasAggregatedScore')
g.V().hasLabel('Profile').out('ProfileHasAggregatedScore')
>78 RU (8 scores found)
作为参考,获取类型的所有顶点的成本为:
g.V().hasLabel('Profile')
>28 RU (110 profiles found)
g.E().hasLabel('ProfileHasAggregatedScore')
>11 RU (8 edges found)
g.V().hasLabel('AggregatedRating')
>11 RU (8 scores found)
单个顶点或边的成本为:
g.V('aProfileId').hasLabel('Profile')
>4 RU (1 found)
g.E('anEdgeId')
> 7RU
G.V('aRatingId')
> 3.5 RU
有人能帮我解释一下,为什么一路上只使用几个顶点进行遍历(见底部的遍历)比搜索所有顶点都要昂贵?我能做些什么来预防它吗?添加带有partitionKey的has筛选器似乎没有帮助。在找到110个顶点后再遍历/查找16个元素(8条边和8个顶点)会使操作成本增加三倍,这似乎很奇怪
(注意,对于1000个配置文件,沿一条边遍历到score节点的成本是2200 RU。考虑到他们的Azure团队强调它的可伸缩性,这似乎很高?)
遍历(如果有帮助的话)(似乎大部分时间都是用out()步骤查找边):
[
{
"gremlin": "g.V().hasLabel('Profile').out('ProfileHasAggregatedScore').executionProfile()",
"totalTime": 46,
"metrics": [
{
"name": "GetVertices",
"time": 13,
"annotations": {
"percentTime": 28.26
},
"counts": {
"resultCount": 110
},
"storeOps": [
{
"fanoutFactor": 1,
"count": 110,
"size": 124649,
"time": 2.47
}
]
},
{
"name": "GetEdges",
"time": 26,
"annotations": {
"percentTime": 56.52
},
"counts": {
"resultCount": 8
},
"storeOps": [
{
"fanoutFactor": 1,
"count": 8,
"size": 5200,
"time": 6.22
},
{
"fanoutFactor": 1,
"count": 0,
"size": 49,
"time": 0.88
}
]
},
{
"name": "GetNeighborVertices",
"time": 7,
"annotations": {
"percentTime": 15.22
},
"counts": {
"resultCount": 8
},
"storeOps": [
{
"fanoutFactor": 1,
"count": 8,
"size": 6303,
"time": 1.18
}
]
},
{
"name": "ProjectOperator",
"time": 0,
"annotations": {
"percentTime": 0
},
"counts": {
"resultCount": 8
}
}
]
}
]
enter code here