Possibilities to improve performance on query?

I have a Python application with FastAPI that performs 3 actions when the endpoint is called: querying the structure that returns vertices and edges (21 itens in total), removing edges and registering/updating vertices and edges. For the query process to return the values, it takes a long time to process and the average is 1.4 seconds. Before, I separated this query that I will leave attached and sent it in threads, but it still took a little longer. Im also using the cluster reader url and both aplication and database are on the same region and VPC. Does anyone have any ideas on how I can improve this? I’m running out of ideas at the momment.
No description
No description
No description
No description
3 Replies
spmallette
spmallette4w ago
it might be helpful if you share a profile of your query: https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-profile-api.html
Gremlin profile API in Neptune - Amazon Neptune
The Gremlin profile feature in Neptune runs a specified traversal, collects metrics about the run, and produces a profile report.
Alex
AlexOP4w ago
I changed the query a little bit but here it is: g.V().has(T.id, "72fd3542-0bf2-45eb-8b5b-dc93a6404dc4").union(.outE("has_profile").has(T.id, containing("a8136fa9-b55a-47b1-9717-c4c44609f805")).otherV().path(),.outE("has_affiliated").has(T.id, containing("a8136fa9-b55a-47b1-9717-c4c44609f805")).otherV().path(),__.bothE("has_controlling").has(T.id, containing("a8136fa9-b55a-47b1-9717-c4c44609f805")).otherV().path()).unfold().dedup().elementMap().profile() https://api.npoint.io/a6ad43c19ffd591004df So I changed to this new one: g.V().has(T.id, "72fd3542-0bf2-45eb-8b5b-dc93a6404dc4").bothE("has_profile", "has_affiliated", "has_controlling").has(T.id, containing("a8136fa9-b55a-47b1-9717-c4c44609f805")).otherV().path().unfold().dedup().elementMap().profile() That has this performance: [{'dur': 0.3111, 'metrics': [{'dur': 0.0705, 'counts': {}, 'name': 'TinkerGraphStep(vertex,[72fd3542-0bf2-45eb-8b5b-dc93a6404dc4])', 'annotations': {'percentDur': 22.66152362584378}, 'id': '0.0.0()'}, {'dur': 0.0806, 'counts': {}, 'name': 'VertexStep(BOTH,[has_profile, has_affiliated, has_controlling],edge)', 'annotations': {'percentDur': 25.908068145290905}, 'id': '2.0.0()'}, {'dur': 0.0196, 'counts': {}, 'name': 'HasStep([~id.containing(a8136fa9-b55a-47b1-9717-c4c44609f805)])', 'annotations': {'percentDur': 6.300225008036001}, 'id': '4.0.0()'}, {'dur': 0.022, 'counts': {}, 'name': 'EdgeOtherVertexStep', 'annotations': {'percentDur': 7.071681131468981}, 'id': '6.0.0()'}, {'dur': 0.0044, 'counts': {}, 'name': 'PathStep', 'annotations': {'percentDur': 1.4143362262937962}, 'id': '8.0.0()'}, {'dur': 0.0073, 'counts': {}, 'name': 'UnfoldStep', 'annotations': {'percentDur': 2.34651237544198}, 'id': '10.0.0()'}, {'dur': 0.0102, 'counts': {}, 'name': 'DedupGlobalStep(null,null)', 'annotations': {'percentDur': 3.278688524590164}, 'id': '12.0.0()'}, {'dur': 0.0965, 'counts': {}, 'name': 'ElementMapStep', 'annotations': {'percentDur': 31.018964963034396}, 'id': '14.0.0()'}]}]
spmallette
spmallette4w ago
with Neptune you can't use the profile() step. you have to use the /profile endpoint as shown in that link i provided
Want results from more Discord servers?
Add your server