nibab
nibab
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
i keep switching back and forth between calling the http action and the mutation directly using the python client. whats curious is that the logs show a mutation time of 700ms when called directly, yet when measuring the time from within the http action using console.time("Mutation start"), i get 4 seconds.
14 replies
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
here is my function fwiw:
export const createRelationshipFromHttp = httpAction(async (ctx, req) => {
console.time("JSON Parse"); // Start timing

const { relationships, apiKey } = await req.json();

console.timeEnd("JSON Parse"); // End timing and log the duration

const pairs = [];
for (const relationship of relationships) {
pairs.push({
sheet_id: relationship.sheet_id as Id<"sheet">,
row_id: relationship.row_id,
row_number: relationship.row_number
})
}

console.time("Mutation start"); // Start timing

await ctx.runMutation(api.relationships.insert, { pairs: pairs, apiKey: apiKey });

console.timeEnd("Mutation start"); // end timing


return new Response("Relationships created", { status: 200 });
})
export const createRelationshipFromHttp = httpAction(async (ctx, req) => {
console.time("JSON Parse"); // Start timing

const { relationships, apiKey } = await req.json();

console.timeEnd("JSON Parse"); // End timing and log the duration

const pairs = [];
for (const relationship of relationships) {
pairs.push({
sheet_id: relationship.sheet_id as Id<"sheet">,
row_id: relationship.row_id,
row_number: relationship.row_number
})
}

console.time("Mutation start"); // Start timing

await ctx.runMutation(api.relationships.insert, { pairs: pairs, apiKey: apiKey });

console.timeEnd("Mutation start"); // end timing


return new Response("Relationships created", { status: 200 });
})
14 replies
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
request.json() is roughly 50ms. using conosle.time on the mutation itself is 3s. it seems that the mutation iteslf is slow. running the same payload without the mutation is 100ms.
14 replies
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
now to be fair...calling the mutation instead of the http action takes just as long.
14 replies
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
im at 70Mbps upload. 3 seconds seems like a pretty bid difference between the start of request.body and the end. its a 300kb payload.
14 replies
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
i am actually noticing relatively similar latency just invoking the mutation from my python client too. i switched over thinking that would make a difference, but it actually looks slower from the client's perspective. in the convex logs im seeing 500ms for the mutation, from the client i see roughly 2 secs.
14 replies
CCConvex Community
Created by nibab on 12/24/2024 in #general
n1bab's Thread
deserializing an object that has 4000 documents in it of the shape: "sheet_id": 123 "row_id": 123
14 replies