0

I have written 8 GET APIs to load in a single page for different dropdowns. All APIs hitting Azure SQL data warehouse to get the record amount of 10 to 15 as they are all dimensions. But out of 8 randomly on the first load one of the APIs take 20 to 30sec where others load in 2 to 3 seconds.

Below is the code snippet for one of the functions. All APIs are same like the below.

import logging
import json
import azure.functions as func

from api.ProjectDetail.ProjectDetails import *

async def main(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Trigger function for list.')

    BigCategory = req.params.get('BigCategory')

    if req.method == "GET":
        response, status_code = await ProjectList().get_List1()
        return func.HttpResponse(body=response,status_code=status_code)

Here this get_List1() just connect to the data warehouse using PyODBC library.

I have FUNCTIONS_WORKER_PROCESS_COUNT set to 10 in the function app application settings.

Any clue why this happens?

Vicky
  • 3
  • 2

1 Answers1

0

According to your description, it should be normal phenomenon. We need to know the function app may not scale out to 10 running instances although you have set FUNCTIONS_WORKER_PROCESS_COUNT with 10 or set WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT with 10. It just means the function app can scale out to maximum 10 running instances but it can't ensure function app scale out to 8 running instances when you request the 8 apis. Here is another post which may help you understand the mechanism of scale out instances.

Since the function doesn't show any error message, so I think it works fine and this situation is normal. If you want the 8 apis be executed quickly, you can use a higher pricing tier plan for your function app.

Hury Shen
  • 14,948
  • 1
  • 9
  • 18