You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-reference-python.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -280,35 +280,37 @@ Likewise, you can set the `status_code` and `headers` for the response message i
280
280
281
281
## Concurrency
282
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).
283
+
By default, the Functions Python runtime can only process one invocation of a function at a time. This concurrency level might not be sufficient in under one or more of the following conditions:
284
284
285
-
For these we recommend the following
285
+
+ You are trying to handle a number of invocations being made at the same time.
286
+
+ Your are processing a large number of I/O events.
287
+
+ Your application is I/O bound.
288
+
289
+
In these situations, you can improve performance by running asynchronously and by using multiple language worker processes.
286
290
287
291
### Async
288
292
289
-
We recommend that you write your Azure Function as an asynchronous coroutine using the `async def` statement.
293
+
We recommend that you use the `async def` statement to make your function run as an asynchronous coroutine.
290
294
291
295
```python
292
-
# Will be run with asyncio directly
293
-
296
+
# Runs with asyncio directly
294
297
295
298
asyncdefmain():
296
299
await some_nonblocking_socket_io_op()
297
300
```
298
301
299
-
If the main() function is synchronous (no qualifier), we automatically run the function in an `asyncio` thread-pool.
302
+
When the `main()` function is synchronous (without the `async`qualifier), the function is automatically run in an `asyncio` thread-pool.
300
303
301
304
```python
302
-
# Would be run in an asyncio thread-pool
303
-
305
+
# Runs in an asyncio thread-pool
304
306
305
307
defmain():
306
308
some_blocking_socket_io()
307
309
```
308
-
### Use multiple language worker processes
309
310
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
+
### Use multiple language worker processes
311
312
313
+
By default, every Functions host instance has a single language worker process. However there is support to have multiple language worker processes per host instance. Function invocations can then be evenly distributed among these language worker processes. Use the [FUNCTIONS_WORKER_PROCESS_COUNT](functions-app-settings.md#functions_worker_process_count) application setting to change this value.
0 commit comments