<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Christopher John</title>
    <description>The latest articles on DEV Community by Christopher John (@christopherjohn).</description>
    <link>https://dev.to/christopherjohn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4126451%2F489e20d2-6f24-42c9-b460-78dcca38648e.png</url>
      <title>DEV Community: Christopher John</title>
      <link>https://dev.to/christopherjohn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/christopherjohn"/>
    <language>en</language>
    <item>
      <title>A performance analysis for SAP related Terraform providers</title>
      <dc:creator>Christopher John</dc:creator>
      <pubDate>Tue, 29 Sep 2026 07:43:41 +0000</pubDate>
      <link>https://dev.to/christopherjohn/a-performance-analysis-for-sap-related-terraform-providers-3k3l</link>
      <guid>https://dev.to/christopherjohn/a-performance-analysis-for-sap-related-terraform-providers-3k3l</guid>
      <description>&lt;p&gt;When looking for recommendations for Terraform state design, one will often see advice like &lt;em&gt;"separate rarely changing and frequently changing elements"&lt;/em&gt; or more generally &lt;em&gt;"keep states small"&lt;/em&gt;. This is useful advice when looking at the topic from a high level, but these are no concrete numbers one can use as a reference point. This also leads to one question often being unanswered: &lt;em&gt;"How many resources are considered a small state?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For the SAP related providers, there are differences of more than 200 times in the duration it takes to refresh different resources. This changes what can be considered small for a state and moves the question from the resource count alone to a question about the combination of resource type and resource count.&lt;/p&gt;

&lt;p&gt;The goal of this blog is to provide some insight into which resources to look out for when designing scripts in regards to the SAP related provider and to give an estimate for how long state files will take before even running them the first time.&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;
Performance of resources

&lt;ul&gt;
&lt;li&gt;Results&lt;/li&gt;
&lt;li&gt;Why are entitlements so slow?&lt;/li&gt;
&lt;li&gt;Effect of Parallelism&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
What is a small state?

&lt;ul&gt;
&lt;li&gt;Results&lt;/li&gt;
&lt;li&gt;Parallelism&lt;/li&gt;
&lt;li&gt;Introducing Dependencies&lt;/li&gt;
&lt;li&gt;Dont forget the init&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;⚠️ Lets start with an exclaimer:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The refresh time of resources is heavily dependent on the speed at which the target system can process the request as well as the general network speed. Even while writing this blog, I experienced huge differnces from time to time. While most of these differences amounted to only around 20-30%, when comparing the averages of runs,  comparing single resources can show differences of more than 30 times. To make sure the results shown later are as accurate and comparable as possible, some scripts were executed multiple times over the course of multiple days. But even with these precautions, treat the shown values not as fixed, but as reference points.&lt;/em&gt; &lt;/p&gt;




&lt;h2&gt;
  
  
  Performance of resources
&lt;/h2&gt;

&lt;p&gt;Let's start by having a look at the performance of the different resources.&lt;/p&gt;

&lt;p&gt;To do this part of the analysis, a script was created containing the SAP providers for &lt;a href="https://registry.terraform.io/providers/SAP/btp/1.26.0" rel="noopener noreferrer"&gt;BTP&lt;/a&gt;, &lt;a href="https://registry.terraform.io/providers/SAP/scc/1.6.0" rel="noopener noreferrer"&gt;SCC&lt;/a&gt; and &lt;a href="https://registry.terraform.io/providers/SAP/sap-cloud-identity-services/0.7.0-beta1" rel="noopener noreferrer"&gt;SCI&lt;/a&gt; as well as the &lt;a href="https://registry.terraform.io/providers/cloudfoundry/cloudfoundry/1.18.0" rel="noopener noreferrer"&gt;Cloud Foundry&lt;/a&gt; provider. The specific resources included:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BTP&lt;/strong&gt;: Directory, Subaccount, Entitlement, Environment, Role, Role Collection, Service Instance, Subscription,  Generic Destination, Trust Configuration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CF&lt;/strong&gt;: Space, Service Instance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCC&lt;/strong&gt;: Subaccount, Mapping, Mapping Resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCI&lt;/strong&gt;: Group Base, User, Application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each resource was included once in the script. After the project was initialised and applied, a terraform plan in refresh only mode was used:‚&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;TF_LOG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;TRACE terraform plan &lt;span class="nt"&gt;-refresh-only&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; tf.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Refresh only mode is not necessarily required as the performance is mostly the same between both modes.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the resulting log file, the refresh time of an resource can then be checked by comparing the timestamp of the following two elements. For this case, this would amount to a refresh time of 257ms.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sci_group_base.group: Refreshing state... [id=d8398e59-49d9-4745-9437-2e2f6114174a]
2026-09-15T19:06:14.045+0200 [TRACE] GRPCProvider.v6: ReadResource
[...]
2026-09-15T19:06:14.302+0200 [TRACE] vertex "sci_group_base.group": visit complete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;p&gt;The described setup was executed 100 times. The resulting refresh times showed the following ranges for the different resources of the providers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BTP&lt;/strong&gt; = 1000-5000ms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CF&lt;/strong&gt; = 50-200ms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCC&lt;/strong&gt; = 100-250ms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCI&lt;/strong&gt; =  200-300ms&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But as we all know, there is always an exception to the rule. In this case, this exception is the &lt;code&gt;btp_subaccount_entitlement&lt;/code&gt; resource with a whopping &lt;strong&gt;13-16 seconds&lt;/strong&gt; of runtime on average.&lt;/p&gt;

&lt;p&gt;Another deviation from this rule is the &lt;code&gt;scc_subaccount&lt;/code&gt; resource with around 1500ms on average.&lt;/p&gt;

&lt;p&gt;As a side note before we continue. For the BTP provider the times can be even further divided with &lt;code&gt;btp_directory&lt;/code&gt;, &lt;code&gt;btp_subaccount_service_instance&lt;/code&gt; and &lt;code&gt;btp_subaccount_subscription&lt;/code&gt; taking around 2500-5000ms, while all other tested resources took around 1000-2000ms.&lt;/p&gt;

&lt;p&gt;Lastly, note that Cloud Foundry providers instances are around 60 times faster then their BTP counterpart. So when a lot of instances are required, switching to CF instances may be beneficial.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why are entitlements so slow?
&lt;/h3&gt;

&lt;p&gt;With this difference in performance between entitlements and the other BTP resources, one will likely ask &lt;em&gt;"Why are entitlements so slow?"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Sadly, I can't give an answer to this. Having a look into the BTP cli, which uses the same API as the Terraform provider, the cli itself falls in the 1-5s estimate with around 4 seconds on average.&lt;/p&gt;

&lt;p&gt;This can be checked via the following command and looking into the verbose output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;btp &lt;span class="nt"&gt;--verbose&lt;/span&gt; list accounts/entitlement
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So either the Terraform provider uses a special endpoint to check these values or the additional processing of the API response that Terraform needs to do takes a lot of time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Effect of Parallelism
&lt;/h3&gt;

&lt;p&gt;With the general results out of the way, let’s look at one more phenomenon that I found while checking the parallelism setting for the second chapter. &lt;/p&gt;

&lt;p&gt;First a short description of parallelism: The argument &lt;code&gt;parallelism=n&lt;/code&gt; allows one to enter a value n (Default = 10), which defines how many operations can be performed at once. Meaning with n=1 only resource at the time can be refreshed, while with n=10 a maximum of 10 resources can be refreshed at once. This is of course limited by (1) the speed of the device on which the command is executed and (2) the API limitations of the target system.&lt;/p&gt;

&lt;p&gt;So what do we expect? Parallelism 1 is slower than parallelism 10, which itself is slower than parallelism 20. With that out of the way, one would expect that the chapter can eb closed, which is also what I expected, before checking the numbers for the second part of the anylsis.&lt;/p&gt;

&lt;p&gt;When looking at the CF provider, for example, we can see exactly what we expect (running 50 space resources):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parallelism&lt;/th&gt;
&lt;th&gt;Time (s)&lt;/th&gt;
&lt;th&gt;Refresh time per resource (ms)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;9.2&lt;/td&gt;
&lt;td&gt;146.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;3.8&lt;/td&gt;
&lt;td&gt;157.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;2.1&lt;/td&gt;
&lt;td&gt;188.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;1.7&lt;/td&gt;
&lt;td&gt;204.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;2.1&lt;/td&gt;
&lt;td&gt;422.8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Especially when looking at the lower parallelism values, the total runtime gets progressively faster. On the other hand, the time of the API call to refresh a element increases possibly due to my Laptop not being fast enough to utilize all the parallelism or due to API rate limits. This results in very high parallelism even being a bit slower.&lt;/p&gt;

&lt;p&gt;The same can also be seen with the SCC and SCI providers. With both having a larger jump from 1 to 10 and afterwards only small or no changes anymore.&lt;/p&gt;

&lt;p&gt;And of course, the same will surely also be applicable to the BTP Provider (running 50 directory resources), right? Well, no. The BTP provider seems to have such extreme API limitations that with just a bit of parallelism, the time of the API calls increases dramatically. This increase is so large, in fact, that the total runtime never really improves, making parallelism for the BTP provider useless. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parallelism&lt;/th&gt;
&lt;th&gt;Time (s)&lt;/th&gt;
&lt;th&gt;Refresh time per resource (ms)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;8.4&lt;/td&gt;
&lt;td&gt;149.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;8.2&lt;/td&gt;
&lt;td&gt;1367.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;8.2&lt;/td&gt;
&lt;td&gt;2501.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;7.7&lt;/td&gt;
&lt;td&gt;5255.0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Another more general effect we can see is that the effect of parallelism seems to depend heavily on the time the APIs take. When using parallelism 10 for example the show below amounts of resources were refreshed at once. Showing that with slower performance of the APIs, more elements can be started simultaneously.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BTP&lt;/strong&gt;: 8.3 elements &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CF&lt;/strong&gt;: 4.5 elements&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCC&lt;/strong&gt;: 4.0 elementes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCI&lt;/strong&gt;: 5.6 elements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Calculated via: ( &amp;lt;API Time per resource&amp;gt; * &amp;lt;Number of resources = 50&amp;gt; ) / &amp;lt;Time&amp;gt;&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What is a small state?
&lt;/h2&gt;

&lt;p&gt;Now let's get to the second question. How many resources are considered small for a state?&lt;/p&gt;

&lt;p&gt;To answer this question, let's first change the initial setup a bit, as it is uncommon to have as many subaccounts as one has instances. The resulting setup has a total of 43 resources in the script, divided the following way:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BTP&lt;/strong&gt;: 1 Directory, 1 Subaccount, 4 Entitlement, 1 Environment, 2 Role, 3 Role Collection, 2 Service Instance, 3 Subscription, 1 Trust Configuration, 2 Generic Destination&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CF&lt;/strong&gt;: 2 Space, 4 Service Instance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCC&lt;/strong&gt;: 1 Subaccount, 2 Mapping, 6 Mapping Resource&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCI&lt;/strong&gt;: 3 Group Base, 5 User, 2 Application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To scale up the script, we will just be duplicating the resources inside the script by a factor f. Meaning f=1 has 43 elements, with f=5 having 215 elements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;p&gt;The following is based on executing the script multiple times. To get this analysis done at some point, the amount of times executed is going down from 20 to 5 depending on the factor used. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Elements&lt;/th&gt;
&lt;th&gt;Time (s)&lt;/th&gt;
&lt;th&gt;Time per resource (s)*&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;43&lt;/td&gt;
&lt;td&gt;18.2&lt;/td&gt;
&lt;td&gt;0.42&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;215&lt;/td&gt;
&lt;td&gt;74.2&lt;/td&gt;
&lt;td&gt;0.35&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;430&lt;/td&gt;
&lt;td&gt;118.4&lt;/td&gt;
&lt;td&gt;0.28&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;1075&lt;/td&gt;
&lt;td&gt;223.9&lt;/td&gt;
&lt;td&gt;0.21&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;2150&lt;/td&gt;
&lt;td&gt;426.5&lt;/td&gt;
&lt;td&gt;0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;* From here on out the time per resource is just calculcated via time/elements and not using the previous method of checking the resource resfresh/ API call time.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We already learned that entitlements are extremely slow, so lets also see how this behaves in a more complex scenario. In this case (using factor 1), removing them reduced the total time down to 9.4s. This means entitlements took around 50% of the time while only accounting for 10% of the resources. With factor 5 this even increases to a reduction of around 55%.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parallelism
&lt;/h3&gt;

&lt;p&gt;We already know from the previous chapter that we cant expect any performance improvements from the BTP Provider alone, but how will it look in combinations with the other providers?&lt;/p&gt;

&lt;p&gt;So let's check how much performance we can gain by increasing the parallelism using the factor 25 script from before. For this, each script was executed 3 times.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parallelism&lt;/th&gt;
&lt;th&gt;Time (s)&lt;/th&gt;
&lt;th&gt;Time per resource (s)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2636.0&lt;/td&gt;
&lt;td&gt;1.22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;647.1&lt;/td&gt;
&lt;td&gt;0.30&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;426.5&lt;/td&gt;
&lt;td&gt;0.20&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;382.3&lt;/td&gt;
&lt;td&gt;0.18&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;375.2&lt;/td&gt;
&lt;td&gt;0.17&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;When comparing especially the 10 and 20 factors, one can see a difference of around 10%. When looking at the times that were possible before when executing the providers seperatly, one could see a difference of around 20% for the CF and SCI providers. CF and SCI provide around 40% of the resources. so the improvement dropping by around 50% (from 20% to 10%) is expected. This also means that the BTP provider had little improvmeent with increased parallelism, even when paired with different providers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing Dependencies
&lt;/h3&gt;

&lt;p&gt;Lastly, lets have a look on the effect of dependencies. For the start we will be ignoring the parallelism argument. &lt;/p&gt;

&lt;p&gt;Comparing the times with and without dependencies shows that there is no real difference between the two, the version with declared dependencies is even a bit faster in the runtime, as shown in the table below. This could either be coincidence or be due to the execution graph being faster to calculate.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Time without dependencies (s)&lt;/th&gt;
&lt;th&gt;Time with dependencies(s)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;18.2&lt;/td&gt;
&lt;td&gt;17.9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;74.2&lt;/td&gt;
&lt;td&gt;50.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;118.4&lt;/td&gt;
&lt;td&gt;130.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;25&lt;/td&gt;
&lt;td&gt;223.9&lt;/td&gt;
&lt;td&gt;250.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;426.5&lt;/td&gt;
&lt;td&gt;414.8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Now let's also introduce the parallelism again with the same logic as before (using factor 25).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parallelism&lt;/th&gt;
&lt;th&gt;Time without dependencies (s)&lt;/th&gt;
&lt;th&gt;Time with dependencies(s)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;647.1&lt;/td&gt;
&lt;td&gt;597.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;426.5&lt;/td&gt;
&lt;td&gt;414.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;20&lt;/td&gt;
&lt;td&gt;382.3&lt;/td&gt;
&lt;td&gt;372.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;375.2&lt;/td&gt;
&lt;td&gt;368.9&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And similar to the results already shown without parallelism, the execution is slightly faster with dependencies included into the script. Additionaly, we can see again a 10% improvement between paralleism 10 and 20. &lt;/p&gt;

&lt;h3&gt;
  
  
  Dont forget the init
&lt;/h3&gt;

&lt;p&gt;As a short sidenote at the end. When talking about the size of the state one should also keep in mind that small states can be a problem for the performance.&lt;/p&gt;

&lt;p&gt;In general, having smaller states results in more states being required. This means that more &lt;code&gt;terraform init&lt;/code&gt; need to be performed. On average the initialisation takes between 2 and 4 seconds per provider. Modules, especially remote ones, may also need around 2 seconds to initialise.&lt;/p&gt;

&lt;p&gt;So, using these numbers, when one would use all four providers at once without any (remote) modules, it would take around 12 seconds to execute the init. So if by splitting the state, less than this time is saved, splitting becomes counterproductive.&lt;/p&gt;

&lt;p&gt;Also, keep in mind that having very small states will diminish the effect seen before, where bigger state files had, to some extent, a better performance per resource than smaller state files.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Now, let’s recap what can be learned from all these numbers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The BTP provider is quite slow, which is especially the case for entitlements. Therefore, one should try to avoid resources from the provider in frequently changing state files.&lt;/li&gt;
&lt;li&gt;When needing a lot of service instances, try to use the CF instances over the BTP instances if possible, due to their performance benefits.&lt;/li&gt;
&lt;li&gt;The effect of parallelism is diminished when the BTP provider is involved. &lt;/li&gt;
&lt;li&gt;Don't forget to take the init into account when trying to improve plan performance by decreasing state size.&lt;/li&gt;
&lt;li&gt;Similary, remember that the performance per resource improves the more resources a state has.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Lastly, when you want to calculate the expected runtime of your scripts, the following table can be used as a reference point for the maximum expected runtime per resource in the state:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Time per resource (ms)&lt;/th&gt;
&lt;th&gt;parallelism 10 adjusted&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;BTP&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;5000&lt;/td&gt;
&lt;td&gt;∼600&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CF&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;∼45&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SCC&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;250&lt;/td&gt;
&lt;td&gt;∼60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SCI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;∼55&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;Thank you for reading this blog. I hope this analysis provided useful insights and practical takeaways. If you have feedback or questions, I would be happy to hear from you.&lt;/p&gt;

&lt;p&gt;The data for the over 19 hours of runtime can be found in a &lt;a href="https://github.com/christopherHJohn/performance-analysis-for-sap-terraform" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;. So have a look there if you are interested in numbers.&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>sap</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
