Azure Cost Optimizations is a very complex topic, and depending on the services you are using, it will require different skills and knowledge. Today, I’m going to speak about Logic App Consumption and skipped triggers.
Of course, when you think about optimizing Logic App Consumption costs, it is very important to understand all the cost calculations and how your flow design affects these costs. Once you understand those topics, you will be faced with different solutions to optimize the costs. Some of them require redesigning your workflows; others are a matter of monitoring, automation, and configuration.
But first, let’s add some context and provide a common example that I will assume that many customers will find it familiar:
We have one or more systems sending messages to a Service Bus Topic or Queue;
And we have a Logic App that is pulling messages each X amount of time;
Process them and send them to other systems.
I found it very common to see the configuration of the Service Bus trigger and see that the polling interval is configured to be 30 seconds.
I ask you not to get me wrong. This configuration itself is not bad, and in many scenarios, it can be exactly what we want and need. But in some cases, it may be too aggressive.
The ideal scenario is to analyze the integration run history, speak to all parties involved, and adjust these values. When I was reviewing one of these cases in one of my clients, I noticed that every day, the pulling only occurred between 5:00 AM and 5:01 AM. Actually, in many cases, it took 9 seconds to process all the messages:
At first, I didn’t give it much importance, but when I checked the pulling configuration and the trigger history, I realized that every 30 seconds, there was a skipped trigger occurrence:
Why is this important?
As I mentioned in the beginning, it is essential to understand all the cost calculations inside Logic Apps correctly. For example:
Per subscription, you will have the first 4,000 actions for free each day!
Notice that this is not 4000 per Logic App. This is the combination of all action executions of all Logic Apps within a subscription.
A good benefit of Logic Apps is that the action costs are quite cheap. For example, 600.000 action executions per day will cost you an average of $14,90 per month.
On the other hand, despite not being too expensive, connection executions are a little bit more costly, and you don’t have free executions.
Another thing that you need to be aware of is that Azure Logic Apps meters all successful and unsuccessful actions as executions. However, Logic Apps don’t meter these actions:
Actions that get skipped due to unmet conditions
Actions that get skipped due to unmet conditions
However, it is important for you to be aware that skipped triggers are billable.
Now, you may be wondering: why should I care? That’s just a few dollars a month!
Let’s do a small exercise:
Knowing that one day is 86400 seconds and you have one Logic App configured with the polling interval to be 30 seconds. That gives you a total of 2,880 trigger executions per day for that single Logic App.
That makes a total of $0.36 per month, $4.32 per year. That’s nothing, right?
Assuming that we have 4 environments: Development, test, QA, and Production, that makes a total of $17.28 per year. It’s still very decent.
But that could also be $0.48 per year if properly configured!
Now, we know that we will have many of those scenarios, so let’s assume that we have 10 Logic Apps in this same situation.
10 Logic Apps x 2,880 trigger executions each = 28800 trigger executions each per day, making a total of $3.60 per month, $43.20 per year.
Once again, assuming that we have 4 environments: Development, test, QA, and Production, that makes a total of $172.80 per year. Well, it is already some money. It is nothing really expensive, but it is not a few dollars anymore.
But what if I tell you that the total cost could also be $4.80 per year if properly configured? That’sThat’s a $168 saving each year in 10 Logic Apps.
Now, if we go to more enterprise scenarios, where we find 100 Logic Apps doing this behavior, and trust me, it is a small number. Then you will have a different picture because:
100 Logic Apps x 2,880 trigger executions each = 288000 trigger executions each per day, making a total of $36.00 per month, $432.00 per year.
If we assume the same number of environments, then that makes a total of $1,728.00 per year.
That can easily be $48.00 per year if properly configured! That’s a huge saving.
So, it can make a difference just by controlling the pulling strategy.
How can we improve this and optimize the costs?
Depending on the scenarios and requirements, you may find several approaches:
The first and straightforward approach is to have a less aggressive pulling period, passing, for example, from every 30 seconds to every 10 minutes or more.
This doesn’t require any redesign of the solution, only a different configuration.
The second approach, for example, is that instead of having the Service Bus trigger, modify it to a Recurrence trigger with a fixed interval and get the messages from the Service Bus.
In this case, the Logic App will run at 5:01, 5:02, 5:03, 5:04, 5:05, 5:06, 5:07, 5:08, 5:09, 5:10, 5:11, 5:12, 5:13, 5:14 every day and try to pull 25 messages.
The third approach can be having the non-production environments disabled at all time and enabled when needed. Something that doesn’t happen often. Normally, all environments are running.
The fourth approach, and one of the most elegant approaches, is to set up a trigger condition. These conditions act as gatekeepers, allowing your Logic App to fire only when specific criteria are met.
On the trigger, click on the three dots (…) and then select the Settings option.
In the Settings for panel, go down to the Trigger Conditions section and add your condition.
How can Serverless360 help you save costs in these scenarios?
Among many other features available in Serverless360to analyze and optimize the costs of your applications, Serveless360 brings you a feature to configure and automate the time of life of specific resources like the Logic Apps. In this particular configuration case, I’m saying that the Logic App will only be enabled daily from 8 PM to 9 PM – a total of 7 hours weekly.
The tool also provides me a total estimated savings of this particular configuration: 95.83% of savings! For me, this is absolutely awesome! And I’m not in charge of controlling costs for my customers, only helping them find ways to optimize their costs and hoping to allow them to save some money.
I hope you enjoy this cost reduction tip, and stay tuned for more content.
Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego!
Author: Sandro Pereira
Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.
He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira
It is really important for companies to have implemented strategies and policies defined before starting to implement integration solutions on Azure or give decision design power to external consultant companies, such as:
Which services are part of the middleware solution in Azure?
What are they for, and when can we use them?
How can we handle requirement exceptions?
Naming conventions, CI/CD, and tag policies
And so on.
I’m about to tell a real story about how I saved more than 20K a year for one of my clients and why those reasons above are so important. I should have asked for a bonus since they have already saved more than 100K because of me.
One of my clients decided to do a POC on Azure Integration using Logic Apps and Service Bus, and during that period, I was busy working on a critical application for that client. So, they decided not to initially involve me and delegated this POC to another partner. The requirements were quite simple:
They would like to have an async process to integrate HR information between the two systems.
They would want to use a no-code, low-code approach using Azure Integration Services as much as possible.
And they did it! They actually implemented a very good solution, looking only at the technical implementation. They decided to design a push implementation that allowed an almost real-time integration.
Once my client contacted me to help them deploy it to production, I only knew that this was a POC and, if everything went well, would be used in production as a real solution. So, if they were asking me to help them deploy to production, that meant at that point that:
Everything worked well and as expected.
The requirements were accomplished.
And they already accepted that solution.
However, I asked if I could do a minor assessment of the solution, mainly to understand how the pieces were built and how we could deploy them to production, and since I was doing it, validate if everything was according to best practices.
And after analyzing the solution, I became curious, so I went to my client and asked the following questions:
Is this a mission-critical application?
Client: No, this is not a mission-critical application.
Do you need almost real-time integration?
Client: No. Even if they are not integrated today, they will be resent tomorrow or in the next synchronization.
On average, how many messages do you send per day?
Typically, close to 100 or less.
Are they big messages (more than 256 KB)?
No, they are small.
Of course, I already expected this type of response and had my homework done. Tools like Serverless360 are used to analyze the cost of the application, and the Azure Calculator is used to predict the costs. I had a rough estimation of how much this solution would cost my client monthly and yearly.
I know they are a big company, but I asked the most obviously logical question in this situation:
Do you know how much this solution costs to you?
Client: Not really, but I know that we have already exceeded the planned budget. Do you know how much?
They were shocked when I told them: ~$677 per month.
But that was worse because they have four environments: DEV, TEST, QA, and PROD, so they need to multiply that by 4, meaning ~2.7Kper month, which means close to 32.5K per year! To process 100 messages per day on a non-critical application!
Is there a better approach?
Well, I don’t say that there is a better approach. An approach is good when it will fulfill the technical and financial expectations. In many cases, the previous approach will be the better approach. Especially if you already have Service Bus premium in your organization and several applications are using that.
Now, if you are starting your journey with Azure or want to control the cost, you should opt for a significantly cheaper approach that also fulfills all the technical requirements.
So, how can we reduce the costs of this solution by 99%?
Yes, you are reading correctly. Actually, it is more than 99% since by the time we end refactoring, the estimated monthly cost was $2.68 (don’t forget we had four environments) or $128.64 per year!
Basically, the only drastic difference in the design of the solution was to transform it into a pull architecture.
Because we only needed a queue, we have downgraded our Service Bus from Premium to Basic.
We removed the Event Grid from the equation since it requires Service Bus Premium.
And finally, we change the trigger of the Logic App to pull messages from the Service Bus queue each X minutes.
All the requirements were accomplished with this new architecture. The costs were surprisingly cheap, which motivated the client, who was already concerned about Azure costs, to adopt more cloud integration solutions.
The solution is still running in production without any changes or improvements.
I hope you enjoy this cost reduction tip, and stay tuned for more content.
Hope you find this helpful! So, if you liked the content or found it useful and want to help me write more, you can buy (or help me buy) my son a Star Wars Lego!
Author: Sandro Pereira
Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.
He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira
There are many things to consider when planning this type of installation. This whitepaper will explain in detail – a step-by-step guideline – how to install and configure Microsoft BizTalk Server 2020 on a basic multi-computer environment using Windows Server 2019, i.e., installation of BizTalk Server with a remote SQL Server (1 SQL Server and 1 BizTalk Server). There will be 3 virtual servers:
1 Domain controller
1 Virtual Machine to host SQL Server
Windows Server 2019
SQL Server 2019SQL Server 2019 Enterprise Edition
1 Virtual Machine to host BizTalk Server.
Windows Server 2019
BizTalk Server 2020 Enterprise or Development Edition
In this scenario, I will perform a basic full installation of Microsoft BizTalk Server 2020, except for the SharePoint Adapter and additional components like Accelerators, ESB Toolkit or UDDI, emulating a production environment. The following components will be installed:
Enterprise Single Sign-On (SSO)
BizTalk Group
BizTalk Runtime
Business Rule Engine
BAM Tools and Alerts
BAM Portal (Although Microsoft has deprecated the BAM portal, it is still possible to install it.)
BizTalk EDI/AS2 Runtime
Microsoft BizTalk Adapters
This information will help you plan the installation and configuration of BizTalk Server 2020, applications, and components on which it depends focused on creating a UAT or Production environment (you can also follow this tutorial to help you create developer environments. However, if this is the case, you need to add some steps and additional components or software, in especially Visual Studio 2019).
Of course, it is assumed that all machines are already installed with the operating system and the latest critical Windows updates from Microsoft. Another presumption is that the domain controller is already installed and configured.
What’s in the Whitepaper for you?
This whitepaper will give you a detailed understanding of the following:
The need for a Domain Controller – Windows Groups and Service Accounts
Preparing Computers for Installation – Important considerations before setting up the
servers
Preparing and Install SQL Server 2019 machine
Prepare and install prerequisites on BizTalk Server 2020 machine
BizTalk Server 2020 – 20 days, 20 posts – day 8. Microsoft announced a few months ago, the release of Microsoft BizTalk Server 2020 – the 11th major release of BizTalk Server –and, as usual with previous versions, I updated my installation and configuration manual for BizTalk Server 2020. This whitepaper will explain in detail – a step-by-step guideline – how to install and configure Microsoft BizTalk Server 2020 on a standalone environment running Windows Server 2019. This information will help you plan the installation and configuration of BizTalk Server 2020, applications and components on which it depends focused on creating a development environment (you can also follow this tutorial to help you create production environments, however, if this is the case you need to skip some steps).
Assumptions and out of scope
We will be assuming that the operating system: Windows Server 2019 and the latest critical Windows updates from Microsoft already have been installed.
In this scenario, we will be performing a full installation of Microsoft BizTalk Server 2020. The following components will be installed:
Enterprise Single Sign-On (SSO).
BizTalk Group.
BizTalk Runtime.
Business Rule Engine.
BAM Tools and Alerts.
BAM Portal.
BAM Portal it is deprecated, but we still can use it.
BizTalk EDI/AS2 Runtime.
REST APIs (Management data APIs)
Management data APIs are endpoints that let you remotely update, add, and query the status of different artifacts in your BizTalk Server environment. The endpoints are added using REST and come with a swagger definition.
BizTalk TMS.
BizTalk TMS is a service that refreshes authentication tokens used by BizTalk. It is a prerequisite for the Office 365 adapters.
Microsoft BizTalk Adapters for Enterprise Applications.
What’s in store for you?
This whitepaper will give you a detailed understanding of the following:
Preparing the Prerequisites and Installation for BizTalk Server 2020
I would like to take this opportunity also to say thanks to Tom Canter for being a reviewer of this installation guide and Lex for all the work to publish this resource.
I hope you enjoy reading this paper and any comments or suggestions are welcome.
You can also find, download and enjoy several other free whitepapers of my own here:
Last time I spoke both at Integrate UK and Integrate USA were in 2017, that in fact was the last time this event also happened in the USA, in which my session was on this same topic, part one of this topic: BizTalk Server Fast & Loud. And in reality, it was merely a happy coincidence, to do these two events again two years later and have decided to do the second part of this previous lecture, because by the time I chose the topic I didn’t know that I would return to the US… but it was a happy coincidence that fit very well!
And the reason I decide this second part was because I had received so much amazing feedback about my BizTalk Server Fast & Loud session two years ago. I can confess that in the beginning, I was a bit nervous to do this sequel, mainly because I want to keep the same good level of the previous one, avoiding what usually happens with the sequels in the movies, as a new part is released the quality goes down… but in the end I think I did a good job, that was confirmed by the awesome feedback provided by the attendees of both events. Personally, I love this session more than the previous one. But if you were not there two years ago, do not watch this talk without seeing the first part of this session here: BizTalk Server Fast & Loud.
About my session
Session Name: BizTalk Server Fast & Loud Part II: Optimizing BizTalk
Session Overview: Following the success of one of Sandro’s previous presentations at Integrate, Sandro decided to go deep on this hardcore BizTalk topic: Optimizing your BizTalk Server. This session will allow you to gain a better view on how to optimize BizTalk Server for better performance in all phases: your team’s proactivity, your code, your environment, and your goals. Once again, this is a very extensive and complex topic and there is no magic formula you can apply to solve all your problems. This presentation will aim to guide you through some of the most important steps, operations, tasks and best practices that you need to do or be aware of, in order to boost the performance of your BizTalk Server projects and that you can adjust or follow according to your needs.
Like previous years, the event in London is recorded, so if for any reason you could not be present at these events, or if you want to review it again, you can now do it here:
There are many things to consider when planning this type of installation; often the network infrastructure already exists, and BizTalk Server must coexist with other network applications. This guide describes some of the considerations that apply to the various parts of a BizTalk Server installation in a basic multi-computer environment. This information will help you plan the installation and configuration of BizTalk Server 2016, applications and components on which it depends.
But this step-by-step guide is not only about installing BizTalk Server 2016, but it will also help you configure and optimize your environment.
What to expect about Installing BizTalk Server 2016 in a Basic Multi-Computer Environment whitepaper
This whitepaper will give you a detailed understanding of the following:
BizTalk Server Installation scenario
The need for a Domain Controller
Preparing Computers for Installation
Preparing and Install SQL Server 2016 machine
Prepare and install prerequisites on BizTalk Server 2016 machine
Testing environment connectivity
Install and configure BizTalk Server 2016 machine
Optimize the BizTalk Server 2016 environment.
Where I can download it
You can download the whitepaper here:
Once again, I would like to take this opportunity also to say thanks to Lex Hegt for helping me reviewing this whitepaper especially for the incredible work of him correcting my horrible English and in this way make the document and my thoughts being readable.
I hope you enjoy reading this paper and any comments or suggestions are welcome.
You can also find, download and enjoy several other free whitepapers of my own here:
Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira
Since the first time we organize the event in London (back in 2013), each year I have had the pleasure of participating in the biggest Microsoft Integration event as a speaker but this year I was able to be present in the two biggest events: London and in Redmond (Microsoft Campus)
This year my session was about: BizTalk Server Fast & Loud
In this session, I talked about a hardcore BizTalk topic that addressed the following question: How can you optimize/tuning your BizTalk environment for performance?
Optimizing your BizTalk Server installation is not an easy thing to do because it affects several layers and skills. This topic is very well documented by the product group but the problem is that it is very extensive and complex. This presentation will aim to guide you through the most important steps, operations or task you need to do or be aware in order to boost the performance of your BizTalk Server environment and that you can adjust or follow according to your needs because, depending on your infrastructure, this can be a straightforward operation or a very extensive and hard operation. But I will try to keep it as simple as possible so everyone can understand and follow.
In the links below you can find the resources that I used in both sessions:
BizTalk Server Fast & Loud Slides
Slides used in INTEGRATE 2017 LONDON:
Slides used in INTEGRATE 2017 USA:
BizTalk Server Fast & Loud Video
Like previous years, the event in London is recorded, so if for any reason you could not be present at these events, or if you want to review it again, you can now do it here:
Day 3 Session 5 – Sandro Pereira — BizTalk Server Fast & Loud
I hope you enjoy it and see you next year!
Author: Sandro Pereira
Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira
It is very important to optimize everything possible for BizTalk archive the best performance it can, especially if you are dealing with BizTalk Server DEV environments on Azure using Azure Virtual Machines. Again, as I explain in a previous post (here), we normally tend to be careful in choosing the VM Disk type and VM sizes mostly because of the price, so tuning the machine is very important, otherwise sometimes they tend to be a little slow and even the most insignificant things (that we think they are) can have a huge impact on BizTalk Server performance. One of the cases that I found these days was the .NET Runtime Optimization Service causing high CPU usage…
… Indeed, and we don’t need to give explanations to explain that everything that may affects the CPU to cause a High Load (or usage) inherently affects and cause huge impact on BizTalk Server performance.
The .NET framework is regularly optimized by Microsoft using the .NET Runtime Optimization Service to make sure you get the best out of the system libraries and this is also done for your installed managed application. It is also more or less responsible for precompiling .NET assemblies in the background. Once it’s done, it will go away. And while you may see CPU usage almost near the 100%, the compilation happens in a process with low priority, so it tries not to steal the CPU for other processes you are doing. Once everything is compiled, assemblies will now be able to share pages across different processes and warm startup will be typically much faster.
Again, once the .NET Runtime Optimization Service once the service finishes his process it will go away, but in my case this process was already running several hours, so instead of waiting until for the computer to idle, we can force it to compile everything now! Solving this “issue” in a fast way (couple of minutes). For that you should:
Open a command prompt as administrator and run the adsutil command. To do this, Press the “Windows key” to open the Start menu and type “cmd” on the Start Search box, right-click in “Command Prompt” and select from the context menu the “Run as administrator” option.
And change to the following folder: “C:WindowsMicrosoft.NETFrameworkv4.0.30319” or “c:WindowsMicrosoft.NETFramework64v4.0.30319” (on a 64-bit operating system)
Type “ngen.exe executequeueditems”, and press ENTER
Wait until the operation is finished, I think you may receive the following message at the command prompt: “All compilation targets are up to date.”
This will process all pending work. Once this is done, the service will shutdown, as it has nothing else to do and you will see that the CPU will be back to the normality.
This can be important to be aware for the Administration team (or DevOps team) while planning your .NET framework update to make sure that everything run smoothly especially in the production environment, otherwise this can be one of the reasons (at least for a few minutes or hours) for you notice that our production applications are running a little slowly.
There is also a PowerShell provide by the Microsoft .NET team to speed up the optimization service: DrainNGenQueue.ps (see more here)
Author: Sandro Pereira
Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc. He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community. View all posts by Sandro Pereira