且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

删除Cosmos DB Graph数据库中的所有边缘超出了RU限制

更新时间:2023-02-14 11:49:18

嗨塞巴斯蒂安,


按照以下Stack Overflow
论坛
,你可以直接在Query Explorer中做很多事情,除了迭代或减少数量而不是完全放弃。


但是,您可以使用
BulkExtractor库
从客户端执行批量操作,其中
BulkDeleteAsync
方法..NET Framework可以正确处理RU阈值问题。


我意识到Stack Overflow主题讨论了丢弃顶点(并且你想丢弃Edges)但讨论点是相同的。


我希望这会有所帮助。





>

We have a graph in Azure Cosmos DB (Gremlin API) with approx 3K vertices and 16K edges. I would like to drop all edges but keep the vertices.

When I run gremlin query like q.E().drop() I get the exception

ExceptionType : RequestRateTooLargeException ExceptionMessage : Message: {"Errors":["Request rate is large"]}

Current RU/s limit is 3000 RU/s

I understand the mechanism behind throwing such error. The "wait and retry" is not an option here - the limit is exceeded by a single query not by many queries, so the next time I run it after some wait period, I will also get the same exception.

The question is what options do I have to drop all the edges with as little queries as possible?

I was trying to run q.E().limit(20).drop() and it works and reports 237.62999999999994 RUs

When I run q.E().limit(2000).drop() I get the exception.

The 'g.E().limit(1).drop()' results shows varying RU cost in Azure Data Explorer:

Executed: g.E().limit(1).drop() (61.72 RUs)
Executed: g.E().limit(1).drop() (53.14 RUs)
Executed: g.E().limit(1).drop() (61.72 RUs)
Executed: g.E().limit(1).drop() (56 RUs)

But constant Request Charge : 546.38

What would be the optimal way to get rid of the edges (in terms of performance and/or in terms of the cost)

Hi Sebastian,

Per the following Stack Overflow forum, there is not much you can do directly in Query Explorer except to iterate or drop in smaller quantities versus doing a full drop.

You could however, use the BulkExtractor library to perform bulk operations from a client, where the BulkDeleteAsync method could be leveraged. The .NET Framework naitively handles RU threshold issues.

I realize the Stack Overflow topic discusses dropping Vertices (and you would like to drop Edges) but the discussion points are the same.

I hope this helps.