How do I run a CPU and memory-intensive Azure Function App with Tesseract OCR inside a Docker container on Azure, utilizing worker processes

Aasawari Bhavsar 0 Reputation points
2025-08-05T10:55:50.23+00:00

I have deployed a Function App on an Azure Container App environment with the following configuration:

4 CPU, 8 GB RAM

Minimum replicas: 1

Maximum replicas: 10

FUNCTIONS_WORKER_PROCESS_COUNT: 2

PYTHON_THREADPOOL_THREAD_COUNT: 1

In the code, I’m using a thread pool with:


with ThreadPoolExecutor(max_workers=8) as executor:
    futures = [executor.submit(call_func, p) for p in payloads]
    for future in as_completed(futures):
        status, content, duration = future.result()
        if status != 200:
            print(f"Error {status}: {content}: duration {duration:.2f} sec")
        else:
            print(f"Success: {content}")

Sometimes all requests succeed, but other times some return 500 errors due to a language worker issue.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.