Workflow Latency issues

  • I am running an n8n Cloud workflow powering a webchat-based file-processing bot (text + menu file uploads + file links), and simple text messages show unexpectedly high latency .

    I am using Gemini for processing and generating reply through http node .
    Code nodes are using javascript codes

  • How can i optimise to reduce latency issues?

I have a workflow to which acts as a chat bot to reply normal text messages and

@vino, that latency on simple text messages is almost certainly your workflow running every message through the full file-processing path — you need an If node right after the trigger to short-circuit plain text and skip the heavy Gemini call for stuff that doesn’t need it.

Wire your chat trigger into the If node, add your API key as a query param on both HTTP nodes, the text-only path skips all the file logic so plain messages should be way faster.

Thank you achamm , my flow has a preprocess part in which the gemini node will identify the intent and generate the reply based on the prompt . it doesnot process the file . all pre conversation between user and system will be replied through this gemini intent node. It takes time to generate replies and pass the reply to SSE push nodes.

Thank you Benjamin, my flow has a preprocess part in which the gemini node will identify the intent and generate the reply based on the prompt . it doesnot process the file . all pre conversation between user and system will be replied through this gemini intent node. It takes time to generate replies and pass the reply to SSE push nodes. Is there anyother option to fix latency .

good day @vino
I’d look at the prompt/context size next. If every simple message sends the full conversation history or a large system prompt to Gemini just to detect intent, latency will stay high even without file processing. I’d try a much smaller intent-classification prompt, limit chat history for that step, and only call the larger reply-generation prompt after the intent is known.

good day @tamy.santos . Thank you for the response. Yes I am combining reply generation prompt and intent classification in same Gemini node , Will try to split it up and execute. Thanks again.