Skip to content

Commit 6bee0e0

Browse files
anirudhgargggailey777
authored andcommitted
Creating a section for Concurrency
-Moved the Async section there -Added a section for using the language worker process count
1 parent c0dc729 commit 6bee0e0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

articles/azure-functions/functions-reference-python.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,14 @@ def main(req: func.HttpRequest) -> func.HttpResponse:
277277
In this function, the value of the `name` query parameter is obtained from the `params` parameter of the [HttpRequest] object. The JSON-encoded message body is read using the `get_json` method.
278278

279279
Likewise, you can set the `status_code` and `headers` for the response message in the returned [HttpResponse] object.
280-
281-
## Async
280+
281+
## Concurrency
282+
283+
The Functions Python runtime can only process one invocation of a function at a time. This concurrency level might not be sufficient if you are trying to handle a number of invocations at the same time and/or if your application is processing a lot of I/O events (i.e. your application is I/O bound).
284+
285+
For these we recommend the following
286+
287+
### Async
282288

283289
We recommend that you write your Azure Function as an asynchronous coroutine using the `async def` statement.
284290

@@ -299,6 +305,10 @@ If the main() function is synchronous (no qualifier), we automatically run the
299305
def main():
300306
some_blocking_socket_io()
301307
```
308+
### Use multiple language worker processes
309+
310+
By default every Functions host has a single language worker process. However there is support to have multiple language worker processes per Functions host. Function invocations can then be evenly distributed among these language worker processes. Use the [FUNCTIONS_WORKER_PROCESS_COUNT](https://docs.microsoft.com/en-us/azure/azure-functions/functions-app-settings#functions_worker_process_count) App setting to change this value.
311+
302312

303313
## Context
304314

0 commit comments

Comments
 (0)