Azure Cosmos DB Gremlin 限制Azure Cosmos DB Gremlin limits

本文介绍 Azure Cosmos DB Gremlin 引擎的限制,并说明他们可能会如何影响客户遍历。This article talks about the limits of Azure Cosmos DB Gremlin engine and explains how they may impact customer traversals.

Cosmos DB Gremlin 基于 Cosmos DB 基础结构而构建。Cosmos DB Gremlin is built on top of Cosmos DB infrastructure. 由于此原因,Azure Cosmos DB 服务限制中所述的所有限制仍然适用。Due to this, all limits explained in Azure Cosmos DB service limits still apply.

限制Limits

达到 Gremlin 限制时,遍历将会取消,并会显示 x-ms-status-code 429,以指示存在限制错误。When Gremlin limit is reached, traversal is canceled with a x-ms-status-code of 429 indicating a throttling error. 有关详细信息,请参阅 Gremlin 服务器响应标头See Gremlin server response headers for more information.

资源Resource 默认限制Default limit 解释Explanation
脚本长度 Script length 64 KB64 KB 每个请求的 Gremlin 遍历脚本的最大长度。Maximum length of a Gremlin traversal script per request.
运算符深度 Operator depth 400400 遍历中的唯一步骤的总数。Total number of unique steps in a traversal. 例如,g.V().out() 的运算符计数为 2:V() 和 out(),g.V('label').repeat(out()).times(100) 的运算符深度为 3:V()、repeat() 和 out(),因为 .times(100).repeat() 运算符的参数。For example, g.V().out() has an operator count of 2: V() and out(), g.V('label').repeat(out()).times(100) has operator depth of 3: V(), repeat(), and out() because .times(100) is a parameter to .repeat() operator.
并行度Degree of parallelism 3232 发往存储层的单个请求中查询的存储分区的最大数。Maximum number of storage partitions queried in a single request to storage layer. 具有数百个分区的图将受到此限制的影响。Graphs with hundreds of partitions will be impacted by this limit.
重复限制 Repeat limit 3232 .repeat() 运算符可执行的最大迭代次数。Maximum number of iterations a .repeat() operator can execute. 在大多数情况下,.repeat() 步骤的每次迭代都会运行广度优先的遍历,这意味着任何遍历都限于顶点之间最多 32 个跃点。Each iteration of .repeat() step in most cases runs breadth-first traversal, which means that any traversal is limited to at most 32 hops between vertices.
遍历超时 Traversal timeout 30 秒30 seconds 超过此时间时,遍历将取消。Traversal will be canceled when it exceeds this time. Cosmos DB Graph 是一种 OLTP 数据库,其中绝大部分遍历都在几毫秒内完成。Cosmos DB Graph is an OLTP database with vast majority of traversals completing within milliseconds. 若要对 Cosmos DB Graph 运行 OLAP 查询,请使用 Apache Spark(带 Graph Data Frames)和 Cosmos DB Spark 连接器To run OLAP queries on Cosmos DB Graph, use Apache Spark with Graph Data Frames and Cosmos DB Spark Connector.
空闲连接超时 Idle connection timeout 1 小时 1 hour Gremlin 服务将使空闲 websocket 连接保持打开状态的时间量。Amount of time the Gremlin service will keep idle websocket connections open. “保持 TCP 连接”数据包或“保持 HTTP 连接”请求不会将连接生存期延长到超过此限制。TCP keep-alive packets or HTTP keep-alive requests don't extend connection lifespan beyond this limit. 如果 websocket 连接上没有正在运行的活动 Gremlin 请求,Cosmos DB Graph 引擎会将该连接视为处于空闲状态。Cosmos DB Graph engine considers websocket connections to be idle if there are no active Gremlin requests running on it.
每小时的资源令牌 Resource token per hour 100100 Gremlin 客户端在连接到某个区域中的 Gremlin 帐户时使用的唯一资源令牌的数目。Number of unique resource tokens used by Gremlin clients to connect to Gremlin account in a region. 当应用程序超出每小时唯一令牌限制时,系统会针对下一次的身份验证请求返回 "Exceeded allowed resource token limit of 100 that can be used concurrently"When the application exceeds hourly unique token limit, "Exceeded allowed resource token limit of 100 that can be used concurrently" will be returned on the next authentication request.

后续步骤Next steps