|
| 1 | +--- |
| 2 | +title: "Announcing OpenFunction 0.8.0: Speed up function launching with Dapr Proxy" |
| 3 | +linkTitle: "Release v0.8.0" |
| 4 | +date: 2022-10-28 |
| 5 | +weight: 93 |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +One of the unique features of OpenFunction is its simple integration with various backend services (BaaS) through [Dapr](https://docs.dapr.io/concepts/components-concept/). Currently, OpenFunction supports Dapr [pub/sub](https://docs.dapr.io/reference/components-reference/supported-pubsub/) and [bindings](https://docs.dapr.io/reference/components-reference/supported-bindings/) building blocks, and more will be added in the future. |
| 10 | + |
| 11 | +In OpenFunction v0.7.0 and versions prior to v0.7.0, OpenFunction integrates with BaaS by injecting a dapr sidecar container into each function instance's pod, which leads to the following problems: |
| 12 | + |
| 13 | +- The entire function instance's launch time is slowed down by the launching of the dapr sidecar container. |
| 14 | +- The dapr sidecar container may consume more resources than the function container itself. |
| 15 | + |
| 16 | +To address the problems above, OpenFunction introduces the `Dapr Standalone Mode` in v0.8.0. |
| 17 | + |
| 18 | +## Dapr Standalone Mode |
| 19 | + |
| 20 | +In Dapr standalone mode, one `Dapr Proxy service` will be created for each function which is then shared by all instances of this function. This way, there is no need to launch a seperate Dapr sidecar container for each function instance anymore which reduces the function launching time significantly. |
| 21 | + |
| 22 | +<div align=center><img width="100%" height="100%" src=/images/docs/en/concepts/function/dapr_proxy.png/></div> |
| 23 | + |
| 24 | +## Choose the appropriate Dapr Service Mode |
| 25 | + |
| 26 | +So now you've 2 options to integrate with BaaS: |
| 27 | + |
| 28 | +- `Dapr Sidecar Mode` |
| 29 | +- `Dapr Standalone Mode` |
| 30 | + |
| 31 | +You can choose the appropriate Dapr Service Mode for your functions. The `Dapr Standalone Mode` is the recommened and default mode. You can use `Dapr Sidecar Mode` if your function doesn't scale frequently or you've difficulty to use the `Dapr Standalone Mode`. |
| 32 | + |
| 33 | +You can control how to integrate with BaaS with 2 flags, both can be set in function's `spec.serving.annotations`: |
| 34 | + |
| 35 | +- `openfunction.io/enable-dapr` can be set to `true` or `false` |
| 36 | +- `openfunction.io/dapr-service-mode` can be set to `standalone` or `sidecar` |
| 37 | +- When `openfunction.io/enable-dapr` is set to `true`, users can choose the `Dapr Service Mode` by setting `openfunction.io/dapr-service-mode` to `standalone` or `sidecar`. |
| 38 | +- When `openfunction.io/enable-dapr` is set to `false`, the value of `openfunction.io/dapr-service-mode` will be ignored and neither `Dapr Sidecar` nor `Dapr Proxy Service` will be launched. |
| 39 | + |
| 40 | +There're default values for both of these two flags if they're not set. |
| 41 | + |
| 42 | +- The value of `openfunction.io/enable-dapr` will be set to `true` if it's not defined in `spec.serving.annotations` and the function definition contains either `spec.serving.inputs` or `spec.serving.outputs`. Otherwise it will be set to `false`. |
| 43 | +- The default value of `openfunction.io/dapr-service-mode` is `standalone` if not set. |
| 44 | + |
| 45 | +Below you can find a function example to set these two flags: |
| 46 | + |
| 47 | +```yaml |
| 48 | +apiVersion: core.openfunction.io/v1beta1 |
| 49 | +kind: Function |
| 50 | +metadata: |
| 51 | + name: cron-input-kafka-output |
| 52 | +spec: |
| 53 | + ... |
| 54 | + serving: |
| 55 | + annotations: |
| 56 | + openfunction.io/enable-dapr: "true" |
| 57 | + openfunction.io/dapr-service-mode: "standalone" |
| 58 | + template: |
| 59 | + containers: |
| 60 | + - name: function # DO NOT change this |
| 61 | + imagePullPolicy: IfNotPresent |
| 62 | + runtime: "async" |
| 63 | + inputs: |
| 64 | + - name: cron |
| 65 | + component: cron |
| 66 | + outputs: |
| 67 | + - name: sample |
| 68 | + component: kafka-server |
| 69 | + operation: "create" |
| 70 | + ... |
| 71 | +``` |
| 72 | + |
| 73 | +[Here](https://github.com/OpenFunction/OpenFunction/releases/tag/v0.8.0) you can find more information about OpenFunction v0.8.0. |
0 commit comments