1
votes

We are in the process of setting up new project. Our requirements is to invoke multiple rest API's and aggregate the response and send it back to mobile client.

We are exploring these 2 options for our experience layer(Integration ) 1. Logic Apps 2. Azure Function

We have observed one major difference with respect to performance between these two.

We run through simple use case to compare the performance.

we are just invoking a rest API to get some metrics with different options available

  1. Just integrate with APIM as back-end service
  2. Using Azure Function
  3. Using Logic Apps

Below are the metrics enter image description here

Logic app is taking longer time for execution compare to other options. Below is the simple logic app to invoke rest api

{
"definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "actions": {
        "GetReferenceData": {
            "inputs": {
                "headers": {
                    "Authorization": "@variables('AuthToken')"
                },
                "method": "GET",
                "uri": "url"
            },
            "runAfter": {
                "Initialize_AuthToken": [
                    "Succeeded"
                ]
            },
            "type": "Http"
        },
        "Initialize_AuthToken": {
            "inputs": {
                "variables": [
                    {
                        "name": "AuthToken",
                        "type": "string",
                        "value": "@{triggerOutputs()['headers']?['Access-Token']}"
                    }
                ]
            },
            "runAfter": {},
            "type": "InitializeVariable"
        },
        "Response": {
            "inputs": {
                "body": "@body('GetReferenceData')",
                "statusCode": "@outputs('GetReferenceData')['statusCode']"
            },
            "kind": "Http",
            "runAfter": {
                "GetReferenceData": [
                    "Succeeded"
                ]
            },
            "type": "Response"
        },
        "Response_2": {
            "inputs": {
                "body": "@body('GetReferenceData')",
                "statusCode": "@outputs('GetReferenceData')['statusCode']"
            },
            "kind": "Http",
            "runAfter": {
                "GetReferenceData": [
                    "Failed",
                    "Skipped",
                    "TimedOut"
                ]
            },
            "type": "Response"
        }
    },
    "contentVersion": "1.0.0.0",
    "outputs": {},
    "parameters": {
        "storageLocation": {
            "defaultValue": [],
            "type": "Array"
        }
    },
    "triggers": {
        "manual": {
            "inputs": {
                "method": "GET",
                "relativePath": "/referenceData",
                "schema": {}
            },
            "kind": "Http",
            "type": "Request"
        }
    }
},
"parameters": {}
}

We have so many use cases where we need to invoke the multiple rest API's and aggregate the result. With the above numbers it seems Function App is doing a way better job than Function App.For parallel operations i may rely upon durable functions over Logic apps.

So i just want to understand why logic app is taking longer time almost double time compared to function for the similar operation?

Is logic app is not meant for these operations?

1
I do not see much difference between the timings between logic apps and sure function it is just few hundred millisecond, what kind of load and system are you planning to integrate?give us some idea so we can suggest somethingsMandar Dharmadhikari
both approaches have cold starts. You can get better results if you use Premium plan for Azure Functions. PS: take a look on Durable Functions (Fan-in and Fan-out Pattern). It will make your life easier.Thiago Custodio
we started of with logic apps because of its capabilities(Easy integration, out of box exception handling, retry etc...). But when we do the same operations with functions we see better performance. Of course milliseconds also does matter. if we start using more and more API's it may multiple.i assume the Logic app results due to by its designChandra Mohan

1 Answers

0
votes

Refer another thread where this question is already answered. Is Logic Apps performance slower compared to a direct .NET REST Call?

Following addition may provide more insight

“Azure Functions is code being triggered by an event, whereas Logic Apps is a separate framework of workflow triggered by an event.” The Logic App is a logical container for one workflow you can define using triggers and actions.

A Logic App runs on a set of infrastructure of an Azure region (VM’s in a data centre), and it consists of several components not visible to you as it is abstracted away. By provisioning a Logic App, you leverage a bit of that infrastructure (indirectly via the Logic App Service) once you define a workflow and the flow gets triggered.

Azure Functions are part of the Azure Web + Mobile suite of App Services and are designed to enable the creation of small pieces of meaningful, reusable methods, easily shared across services.