Use Case
I am trying to set up cypress testing on the azure function. We'll deploy the cypress code on the azure function which runs on Linux VM. Cypress has some system-level dependencies which are not available directly on the azure function instance.
Below are the dependencies required by cypress to run on linux
libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
In order to get these dependencies on the azure function, I tried to use Docker Image where all the dependencies will be installed.
My Azure Subscription
I am using the azure function premium plan and EP1 instance.

How I am triggering the function
I am using the azure storage queue to trigger the function.
Problem
Here is my azure storage queue triggered function
const cypress = require("cypress");
const fs = require("fs");
const path = require("path");
const startTest = require("./e2eTest/index");
const axios = require("axios");
module.exports = async function (context, myQueueItem) {
await axios
.get(
`https://staging-personal-vm.com/?msg=${myQueueItem}&ts=${new Date().toLocaleTimeString()}&finished=false&execTime=0`
)
.then(console.log)
.catch(console.log);
let startTime = Date.now();
try {
// start cypress testing...
await startTest(myQueueItem);
} catch (error) {}
let endTime = Date.now();
await axios
.get(
`https://staging-personal-vm.com/?msg=${myQueueItem}&ts=${new Date().toLocaleTimeString()}&finished=true&execTime=${(
(endTime - startTime) /
1000 /
60
).toFixed(2)}`
)
.then(console.log)
.catch(console.log);
};
Once my azure function will receive a message, it'll start processing and sending the result.
I used my personal VM of azure for sending the logs. I'm sending a log of when the function just started the execution. Another log I am sending when the function just finished processing.
Msg Time Stamp Finished Execution Time
2 2:35:44 PM FALSE 0
1 2:35:47 PM FALSE 0
3 2:36:05 PM FALSE 0
4 2:36:05 PM FALSE 0
5 2:36:52 PM FALSE 0
6 2:36:56 PM FALSE 0
7 2:37:22 PM FALSE 0
8 2:37:43 PM FALSE 0
9 2:38:56 PM FALSE 0
10 2:39:13 PM FALSE 0
11 2:39:54 PM FALSE 0
12 2:39:58 PM FALSE 0
13 2:40:33 PM FALSE 0
14 2:41:40 PM FALSE 0
15 2:41:48 PM FALSE 0
16 2:41:49 PM FALSE 0
17 2:42:10 PM FALSE 0
18 2:42:29 PM FALSE 0
19 2:42:30 PM FALSE 0
20 2:42:41 PM FALSE 0
9 3:38:41 PM FALSE 0 => function with message 9 started execution after ~1 hour execution started for function with message 2. I am pushing all the messages at once.
As you can see in the above table, there is clearly a 1-hour gap between when the first message started execution and when the last message started execution.
Why there is so much delay between the first and last messages, as all the messages are pushed into the queue at the same time?
As per my understanding, as the batchSize is 1, azure should launch a new VM for each function and there shouldn’t be a delay.
host.json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
},
"functionTimeout": "00:59:00",
"extensions": {
"queues": {
"batchSize": 1
}
}
}
Can someone let me know how azure processes messages?
Thanks in advance :)