<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Performance Archives - Blog IT</title>
	<atom:link href="https://blogit.create.pt/category/performance/feed/" rel="self" type="application/rss+xml" />
	<link>https://blogit.create.pt/category/performance/</link>
	<description>Create IT blogger community</description>
	<lastBuildDate>Wed, 29 May 2019 11:26:36 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>
	<item>
		<title>Query performance for JSON objects inside SQL Server using JSON_VALUE function</title>
		<link>https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/</link>
					<comments>https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/#comments</comments>
		
		<dc:creator><![CDATA[Gonçalo Melo]]></dc:creator>
		<pubDate>Thu, 20 Dec 2018 09:39:12 +0000</pubDate>
				<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[SQL]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=8077</guid>

					<description><![CDATA[<p>Following up on this article about querying JSON Data I would like to talk about how to improve searches on JSON data inside SQL Server. Starting SQL Server 2016 Microsoft deployed a set of functions that allow us to work with JSON data in a structured way inside SQL Server. I will introduce a small [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/">Query performance for JSON objects inside SQL Server using JSON_VALUE function</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Following up on <a href="https://blogit.create.pt////diogoguiomar/2018/02/26/query-a-json-array-column-in-sql/">this article about querying JSON Data</a> I would like to talk about how to improve searches on JSON data inside SQL Server. Starting SQL Server 2016 Microsoft deployed a set of functions that allow us to work with JSON data in a structured way inside SQL Server.</p>



<p>I will introduce a small usage sample for the <strong>JSON_VALUE </strong>function in combination with indexes to improve information retrieval from a table containing one JSON object. For our testes, we have a <strong>UserDetailTest </strong>table that has more than 500k rows with 2 columns: an UserId and a nvarchar(max) to hold a small JSON details string like the following:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
SELECT *, LEN(DetailsJSON) AS &#x5B;Len(DetailsJSON)] FROM UserDetailTest
</pre></div>


<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="937" height="188" src="https://blogit.create.pt////wp-content/uploads/2018/12/sampleTable.png" alt="" class="wp-image-8153" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable.png 937w, https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable-300x60.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable-768x154.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/sampleTable-696x140.png 696w" sizes="(max-width: 937px) 100vw, 937px" /></figure>



<p>I will activate time statistics and clean SQL Server cache between each query to have some consistency across the execution times using the following SQL statements:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
CHECKPOINT
DBCC DROPCLEANBUFFERS
SET STATISTICS TIME ON
</pre></div>


<h2 class="wp-block-heading">JSON_VALUE Function intro</h2>



<p>The JSON_VALUE function extracts a value from a JSON string. This functions receives 2 arguments, the first being an expression for the JSON value and the second a path for the value we want to obtain. A simple sample with an inline JSON object would be the following:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
SELECT JSON_VALUE('{"PostalCode":"376-3765","PhoneNumber":"351003765718"}', '$.PhoneNumber')
</pre></div>


<figure class="wp-block-image"><img decoding="async" width="1245" height="123" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult0.png?fit=696%2C69&amp;ssl=1" alt="" class="wp-image-8182" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0.png 1245w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-300x30.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-768x76.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-1024x101.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-696x69.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult0-1068x106.png 1068w" sizes="(max-width: 1245px) 100vw, 1245px" /></figure>



<p>The return is a scalar value (nvarchar(4000)) for the PhoneNumber element.</p>



<h2 class="wp-block-heading">Query scenarios</h2>



<p>Starting with one of the <strong>really&nbsp;worst </strong>case scenario (yes, this can happen&#8230;):</p>



<figure class="wp-block-image"><img decoding="async" width="1024" height="240" src="https://blogit.create.pt////wp-content/uploads/2018/12/selectResult20-1024x240.png" alt="" class="wp-image-8197" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-1024x240.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-300x70.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-768x180.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-696x163.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20-1068x250.png 1068w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult20.png 1275w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>More than 17 seconds really seems like a worst scenario! Next, we will use the JSON_VALUE function to get the PhoneNumber from the JSON string and use it in our where clause:</p>



<figure class="wp-block-image"><img decoding="async" width="1266" height="301" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult22.png?fit=696%2C165&amp;ssl=1" alt="" class="wp-image-8198" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22.png 1266w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-300x71.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-768x183.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-1024x243.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-696x165.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult22-1068x254.png 1068w" sizes="(max-width: 1266px) 100vw, 1266px" /></figure>



<p>This still takes more than 3 seconds. A good improvement, but yet a high cost if we need to search information in this way.</p>



<h2 class="wp-block-heading" id="mce_9">Index creation</h2>



<p>Let&#8217;s add a new virtual column to table that displays the result from the JSON_VALUE function &#8211; this will allow us to create an index and simplify the SELECT queries.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
ALTER TABLE UserDetailTest 
	ADD vPhoneNumber AS 
	CAST(JSON_VALUE(DetailsJSON, '$.PhoneNumber') AS NVARCHAR(255));
</pre></div>


<p>The cast truncates the output from the JSON_VALUE&nbsp;to ensure that it does not exceed the maximum lenght for the index key. Now, if we search using the column, the result is still more or less the same 3 seconds has before:</p>



<ul class="wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><img decoding="async" width="1274" height="311" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult23.png?fit=696%2C170&amp;ssl=1" alt="" data-id="8199" data-link="https://blogit.create.pt////?attachment_id=8199" class="wp-image-8199" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23.png 1274w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-300x73.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-768x187.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-1024x250.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-696x170.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult23-1068x261.png 1068w" sizes="(max-width: 1274px) 100vw, 1274px" /></figure></li></ul>



<p>Let&#8217;s create an index and perform the search again:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
CREATE INDEX idx_vPhoneNumber ON &#x5B;UserDetailTest] (vPhoneNumber);

</pre></div>


<ul class="wp-block-gallery columns-1 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex"><li class="blocks-gallery-item"><figure><img decoding="async" width="1270" height="316" src="https://i1.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult24.png?fit=696%2C173&amp;ssl=1" alt="" data-id="8201" data-link="https://blogit.create.pt////?attachment_id=8201" class="wp-image-8201" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24.png 1270w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-300x75.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-768x191.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-1024x255.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-696x173.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult24-1068x266.png 1068w" sizes="(max-width: 1270px) 100vw, 1270px" /></figure></li></ul>



<p>Consequently the improvement is huge, 13 miliseconds is more interesting! But what&#8217;s the cost?</p>



<h2 class="wp-block-heading">The cost</h2>



<p>When we create an index, we&#8217;re basically trading space for time &#8211; more occupied space versus faster operations. Therefore let&#8217;s see what the increase is using&nbsp;<strong>sp_spaceused</strong> function before and after index creation:</p>



<table class="wp-block-table is-style-regular"><tbody><tr><td></td><td><strong>rows</strong></td><td><strong>reserved</strong></td><td><strong>data</strong></td><td><strong>index_size</strong></td><td><strong>unused</strong></td></tr><tr><td><strong>Initial</strong></td><td>557801              </td><td>1120904 KB</td><td>1115584 KB</td><td>5224 KB</td><td>96 KB</td></tr><tr><td><strong>After Index</strong></td><td>557801</td><td>1148752 KB</td><td>1115584 KB</td><td>32992 KB</td><td>176 KB</td></tr></tbody></table>



<p>Probably, an interesting comparison would be if the PhoneNumber column was an explicit column in that table containing the value. Let&#8217;s do that!</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; title: ; notranslate">
ALTER TABLE UserDetailTest  
	ADD PhoneNumberCopy NVARCHAR(255)

UPDATE UserDetailTest
	SET PhoneNumberCopy = vPhoneNumber
</pre></div>


<p>The sp_spaceused remained the same &#8211; SQL Server internal black magic regarding space allocation (for another time!). But performance wise, for this approach in my machine this query still took more than 2 seconds to complete:</p>



<figure class="wp-block-image"><img decoding="async" width="1269" height="362" src="https://i2.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult26.png?fit=696%2C198&amp;ssl=1" alt="" class="wp-image-8203" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26.png 1269w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-300x86.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-768x219.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-1024x292.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-696x199.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult26-1068x305.png 1068w" sizes="(max-width: 1269px) 100vw, 1269px" /></figure>



<p>Slightly better than the query with the JSON function but the advantage is that in this scenario SQL can better optimize the searches. The following runs of the same query without clearing the cache returns results much faster &#8211; each took around 220 miliseconds to complete:</p>



<figure class="wp-block-image"><img decoding="async" width="1263" height="343" src="https://i2.wp.com/blogit.create.pt/wp-content/uploads/2018/12/selectResult27.png?fit=696%2C189&amp;ssl=1" alt="" class="wp-image-8204" srcset="https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27.png 1263w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-300x81.png 300w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-768x209.png 768w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-1024x278.png 1024w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-696x189.png 696w, https://blogit.create.pt/wp-content/uploads/2018/12/selectResult27-1068x290.png 1068w" sizes="(max-width: 1263px) 100vw, 1263px" /></figure>



<h2 class="wp-block-heading">Summary Results</h2>



<p>Just to sum up all the results for the different types of searches comparing the first execution after cache clean up and the following runs.&nbsp;I did several iterations for each step just to make sure the results were consistent&nbsp;although the goal was just to have a baseline. Certanly, the use of this will depend on each case.</p>



<table class="wp-block-table"><tbody><tr><td><strong>WHERE clausule type</strong></td><td><strong>First run</strong></td><td><strong>Following runs</strong></td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE DetailsJson LIKE '%PhoneNumber&quot;:&quot;351003765718&quot;%'</pre></td><td>17754 ms</td><td>around the same</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE JSON_VALUE(DetailsJson, '$.PhoneNumber') = '351003765718'</pre></td><td>3375 ms</td><td>1958 ms</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE vPhoneNumber = '351003765718'</pre>vPhoneNumber is not indexed&nbsp;</td><td>3339 ms</td><td>1332 ms</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE vPhoneNumber = '351003765718'</pre> vPhoneNumber is indexed</td><td>13 ms</td><td>0 ms</td></tr><tr><td><pre class="brush: sql; gutter: false; title: ; notranslate">WHERE PhoneNumberCopy  = '351003765718'</pre>PhoneNumberCopy&nbsp; is of type nvarchar(255) and explicitly contains all values</td><td>2309 ms</td><td>222 ms</td></tr></tbody></table>



<p></p>
<p>The post <a href="https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/">Query performance for JSON objects inside SQL Server using JSON_VALUE function</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/goncalomelo/2018/12/20/query-performance-for-json-objects-inside-sql-server/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
			</item>
		<item>
		<title>Straight A&#8217;s in WebPagetest with Umbraco</title>
		<link>https://blogit.create.pt/andresantos/2018/11/27/straight-as-in-webpagetest-with-umbraco/</link>
					<comments>https://blogit.create.pt/andresantos/2018/11/27/straight-as-in-webpagetest-with-umbraco/#respond</comments>
		
		<dc:creator><![CDATA[André Santos]]></dc:creator>
		<pubDate>Tue, 27 Nov 2018 21:40:06 +0000</pubDate>
				<category><![CDATA[Umbraco]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Microsoft Azure]]></category>
		<category><![CDATA[azure cdn]]></category>
		<category><![CDATA[blobstorage]]></category>
		<category><![CDATA[cdn]]></category>
		<category><![CDATA[imageprocessor]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[UmbracoFileSystemProviders.Azure]]></category>
		<category><![CDATA[WebPagetest]]></category>
		<guid isPermaLink="false">https://blogit.create.pt/?p=7450</guid>

					<description><![CDATA[<p>Before launching a new website, there&#8217;s a checklist I go through, to make sure that everything is ready. One of the items in my checklist is to test the website against WebPagetest. WebPagetest is a tool that was originally developed by AOL for use internally and was open-sourced in 2008 under a BSD license. The [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andresantos/2018/11/27/straight-as-in-webpagetest-with-umbraco/">Straight A&#8217;s in WebPagetest with Umbraco</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span class="dropcap dropcap3">B</span>efore launching a new website, there&#8217;s a checklist I go through, to make sure that everything is ready. One of the items in my checklist is to test the website against <strong>WebPagetest</strong>.</p>
<blockquote class="td_quote_box td_box_right"><p>WebPagetest is a tool that was originally developed by <a href="http://dev.aol.com/">AOL</a> for use internally and was open-sourced in 2008 under a BSD license. The online version at <a href="https://www.webpagetest.org/">www.webpagetest.org</a> is run for the benefit of the performance community with several companies and individuals providing the testing infrastructure around the globe.</p></blockquote>
<p>This tool tests any website against 6 major performance affecting factors, and provides a myriad of graphs and logs that make abundantly clear what might be slowing down your site.</p>
<p>In this post I&#8217;ll provide ways to make your site get straight A&#8217;s in WebPagetest.</p>
<p><span id="more-7450"></span></p>
<h1>Setup</h1>
<p>To start this off, let&#8217;s setup our environment. We&#8217;ll just need the following:</p>
<ul>
<li>Visual Studio 2017</li>
<li>Microsoft Azure account</li>
</ul>
<p>In Visual Studio, let&#8217;s create a new empty ASP.NET Web Application project. Then, we&#8217;ll need the latest and greatest Umbraco NuGet package (I used version 7.12.4). Once it finishes installing, just launch the website and install Umbraco with all defaults. This will bootstrap Umbraco with the Starter Website, which we&#8217;ll use as our &#8220;guinea pig&#8221; for WebPagetest.</p>
<p>Next: publish it! We can use the publish wizard to automatically create our new WebApp and SQL Database in Azure. Before installing Umbraco in Azure, we&#8217;ll need to change the Web.config so that the install wizard is run again (I use <a href="https://filezilla-project.org/">Filezilla</a> to change it in Azure):</p>
<p>Clear the Umbraco version number:</p>
<pre class="brush: xml; title: Web.config; notranslate">
&lt;add key=&quot;umbracoConfigurationStatus&quot; value=&quot;&quot;&gt;
</pre>
<p>Clear the Umbraco connection string:</p>
<pre class="brush: xml; title: Web.config; notranslate">
&lt;add name=&quot;umbracoDbDSN&quot; connectionstring=&quot;&quot; providername=&quot;System.Data.SqlClient&quot;&gt;
</pre>
<p>With these changes in place, we&#8217;re good to go. This time, we&#8217;ll not use the defaults in the Umbraco install wizard, since we&#8217;ll want to use the SQL Database we&#8217;ve just created in Azure.</p>
<h1>First test</h1>
<p>For our tests, we&#8217;ll use the people page of the Starter Website. This is the score I got with a standard (S0) database and a basic WebApp:</p>
<p><img decoding="async" class="size-medium wp-image-7454 aligncenter" src="https://blogit.create.pt////wp-content/uploads/2018/09/first-webpagetest-300x91.png" alt="" width="300" height="91" srcset="https://blogit.create.pt/wp-content/uploads/2018/09/first-webpagetest-300x91.png 300w, https://blogit.create.pt/wp-content/uploads/2018/09/first-webpagetest-768x233.png 768w, https://blogit.create.pt/wp-content/uploads/2018/09/first-webpagetest-696x211.png 696w, https://blogit.create.pt/wp-content/uploads/2018/09/first-webpagetest.png 841w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>Since this is a very small site, only used for demonstration purposes, half of the metrics are already cleared! However, this is not usually the case for bigger websites. For this reason, I&#8217;ll still present some solutions to improve the grade for these metrics.</p>
<h1>First Byte Time</h1>
<p><em>These test measures the time it takes for the first byte to reach the client&#8217;s browser after the initial http request.</em></p>
<p>There are two main factors that influence this result:</p>
<ul>
<li>Server power</li>
<li>The webpage complexity (integrations with external services, complex logic involved, etc)</li>
</ul>
<h3>How to get an A</h3>
<p>The easiest way to mitigate this problem is by caching. You can see how to do output caching in Umbraco by reading this old post of mine: <a href="https://blogit.create.pt////andresantos/2016/06/30/umbraco-and-donut-output-cache/">https://blogit.create.pt////andresantos/2016/06/30/umbraco-and-donut-output-cache/</a>.</p>
<h1>Keep-alive Enabled</h1>
<p><em>Keep alive is a method to allow the same tcp connection for HTTP conversation instead of opening a new one with each new request.</em></p>
<h3>How to get an A</h3>
<p>This setting is active by default in IIS, so, it&#8217;s also active by default in Azure WebApps, so it&#8217;s easy to get an A!</p>
<h1>Compress Transfer</h1>
<p><em>Gzip compresses your webpages, style sheets and javascripts, before sending them over to the browser. This drastically reduces transfer time since the files are much smaller.</em></p>
<h3>How to get an A</h3>
<p>Just add this setting to your Web.config file:</p>
<pre class="brush: xml; title: Web.config; notranslate">
&lt;httpcompression dynamiccompressionenablecpuusage=&quot;0&quot; dynamiccompressiondisablecpuusage=&quot;90&quot; nocompressionforhttp10=&quot;false&quot; nocompressionforproxies=&quot;false&quot;&gt;
    &lt;statictypes&gt;
        &lt;add mimetype=&quot;text/*&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;message/*&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;application/javascript&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;application/font-woff&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;application/font-woff2&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;application/vnd.ms-fontobject&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;application/octet-stream&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;*/*&quot; enabled=&quot;false&quot;&gt;
    &lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/statictypes&gt;
    &lt;dynamictypes&gt;
        &lt;add mimetype=&quot;text/*&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;message/*&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;application/javascript&quot; enabled=&quot;true&quot;&gt;
        &lt;add mimetype=&quot;*/*&quot; enabled=&quot;false&quot;&gt;
    &lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/add&gt;&lt;/dynamictypes&gt;
&lt;/httpcompression&gt;
</pre>
<h1>Compress Images</h1>
<p><em><span class="ILfuVd">Image compression is minimizing the size in bytes of a graphics file without degrading the quality of the image to an unacceptable level.</span></em></p>
<h3>How to get an A</h3>
<p>In Umbraco, to get an A in this grade, you need to do two things:</p>
<ol>
<li>Crop every image and use srcsets where you can</li>
<li>Use the PostProcessor plugin for Image Processor</li>
</ol>
<p>Cropping an image is easy in Umbraco:</p>
<pre class="brush: xml; title: People.cshtml; notranslate">
&lt;div class=&quot;employee-grid__item__image&quot; style=&quot;background-image: url('@person.Photo.GetCropUrl(width: 323, height: 300, quality: 85)')&quot;&gt;&lt;/div&gt;
</pre>
<p>In order to use the PostProcessor plugin, you just need to install it via nuget: <a href="https://www.nuget.org/packages/ImageProcessor.Web.PostProcessor/1.3.1.25">https://www.nuget.org/packages/ImageProcessor.Web.PostProcessor/1.3.1.25</a>.</p>
<h1>Cache Static Content</h1>
<p><em>Static content is content that changes rarely. For this reason it can be cached in the user&#8217;s browser to avoid downloading the same file over and over again.</em></p>
<h3>How to get an A</h3>
<p>Just set the time it takes for the content to expire in the user&#8217;s browser and add extra mime types if you want:</p>
<pre class="brush: xml; title: Web.config; notranslate">
&lt;staticcontent&gt;
    &lt;clientcache cachecontrolmode=&quot;UseMaxAge&quot; cachecontrolmaxage=&quot;7.24:00:00&quot;&gt;
    &lt;remove fileextension=&quot;.air&quot;&gt;
    &lt;mimemap fileextension=&quot;.air&quot; mimetype=&quot;application/vnd.adobe.air-application-installer-package+zip&quot;&gt;
    &lt;remove fileextension=&quot;.svg&quot;&gt;
    &lt;mimemap fileextension=&quot;.svg&quot; mimetype=&quot;image/svg+xml&quot;&gt;
    &lt;remove fileextension=&quot;.woff&quot;&gt;
    &lt;mimemap fileextension=&quot;.woff&quot; mimetype=&quot;application/x-font-woff&quot;&gt;
    &lt;remove fileextension=&quot;.woff2&quot;&gt;
    &lt;mimemap fileextension=&quot;.woff2&quot; mimetype=&quot;application/x-font-woff2&quot;&gt;
    &lt;remove fileextension=&quot;.less&quot;&gt;
    &lt;mimemap fileextension=&quot;.less&quot; mimetype=&quot;text/css&quot;&gt;
    &lt;remove fileextension=&quot;.mp4&quot;&gt;
    &lt;mimemap fileextension=&quot;.mp4&quot; mimetype=&quot;video/mp4&quot;&gt;
    &lt;remove fileextension=&quot;.json&quot;&gt;
    &lt;mimemap fileextension=&quot;.json&quot; mimetype=&quot;application/json&quot;&gt;
&lt;/mimemap&gt;&lt;/remove&gt;&lt;/mimemap&gt;&lt;/remove&gt;&lt;/mimemap&gt;&lt;/remove&gt;&lt;/mimemap&gt;&lt;/remove&gt;&lt;/mimemap&gt;&lt;/remove&gt;&lt;/mimemap&gt;&lt;/remove&gt;&lt;/mimemap&gt;&lt;/remove&gt;&lt;/clientcache&gt;&lt;/staticcontent&gt;
</pre>
<h1>Effective use of CDN</h1>
<p><em> A content delivery network (CDN) refers to a geographically distributed group of servers which work together to provide fast delivery of Internet content. A CDN allows for the quick transfer of assets needed for loading Internet content including HTML pages, javascript files, stylesheets, images, and videos.</em></p>
<h3>How to get an A</h3>
<p>In Umbraco, you can achieve this last grade by doing two things:</p>
<ol>
<li>Use an Azure Blob Storage for media storage by installing this nuget package: <a href="https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure">https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure</a>.</li>
<li>Create an Azure CDN for serving these blobs through a content delivery network.</li>
</ol>
<p>After creating an Azure CDN service and waiting about an hour for it to be available, the following presents my configuration for the media assets to be provided by it:</p>
<pre class="brush: xml; title: config/imageprocessor/security.config; notranslate">
&lt;!--?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?--&gt;
&lt;security&gt;
  &lt;services&gt;
    &lt;service name=&quot;LocalFileImageService&quot; type=&quot;ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web&quot;&gt;
    &lt;!--Disable the LocalFileImageService and enable this one when using virtual paths. --&gt;
    &lt;service prefix=&quot;media/&quot; name=&quot;CloudImageService&quot; type=&quot;ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web&quot;&gt;
      &lt;settings&gt;
        &lt;setting key=&quot;Container&quot; value=&quot;media&quot;&gt;
        &lt;setting key=&quot;MaxBytes&quot; value=&quot;8194304&quot;&gt;
        &lt;setting key=&quot;Timeout&quot; value=&quot;30000&quot;&gt;
        &lt;setting key=&quot;Host&quot; value=&quot;https://&lt;umbracositename&gt;.blob.core.windows.net/media&quot;&gt;
      &lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/settings&gt;
    &lt;/service&gt;
  &lt;/service&gt;&lt;/services&gt;
&lt;/security&gt;
</pre>
<pre class="brush: xml; title: config/imageprocessor/security.config; notranslate">
&lt;!--?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?--&gt;
&lt;caching currentcache=&quot;AzureBlobCache&quot;&gt;
  &lt;caches&gt;
    &lt;cache name=&quot;AzureBlobCache&quot; type=&quot;ImageProcessor.Web.Plugins.AzureBlobCache.AzureBlobCache, ImageProcessor.Web.Plugins.AzureBlobCache&quot; maxdays=&quot;365&quot;&gt;
      &lt;settings&gt;
        &lt;setting key=&quot;CachedStorageAccount&quot; value=&quot;DefaultEndpointsProtocol=https;AccountName=&lt;accountname&gt;;AccountKey=&lt;accountkey&gt;;EndpointSuffix=core.windows.net&quot;&gt;
        &lt;setting key=&quot;CachedBlobContainer&quot; value=&quot;cache&quot;&gt;
        &lt;setting key=&quot;UseCachedContainerInUrl&quot; value=&quot;false&quot;&gt;
        &lt;setting key=&quot;SourceStorageAccount&quot; value=&quot;DefaultEndpointsProtocol=https;AccountName=&lt;accountname&gt;;AccountKey=&lt;accountkey&gt;;EndpointSuffix=core.windows.net&quot;&gt;
        &lt;setting key=&quot;SourceBlobContainer&quot; value=&quot;media&quot;&gt;
        &lt;setting key=&quot;StreamCachedImage&quot; value=&quot;false&quot;&gt;
        &lt;setting key=&quot;CachedCDNRoot&quot; value=&quot;https://&lt;cdnrootname&gt;.azureedge.net&quot;&gt;
        &lt;setting key=&quot;CachedCDNTimeout&quot; value=&quot;1000&quot;&gt;
      &lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/setting&gt;&lt;/settings&gt;
    &lt;/cache&gt;
  &lt;/caches&gt;
&lt;/caching&gt;
</pre>
<h1>Conclusion</h1>
<p>So, if you followed these tips correctly, you&#8217;ll be able to run WebPagetest and get the same result as I did:</p>
<p><img decoding="async" class="wp-image-7937 size-medium aligncenter" src="https://blogit.create.pt////wp-content/uploads/2018/11/straightAs-300x89.png" alt="straightAs" width="300" height="89" srcset="https://blogit.create.pt/wp-content/uploads/2018/11/straightAs-300x89.png 300w, https://blogit.create.pt/wp-content/uploads/2018/11/straightAs-768x228.png 768w, https://blogit.create.pt/wp-content/uploads/2018/11/straightAs-696x207.png 696w, https://blogit.create.pt/wp-content/uploads/2018/11/straightAs.png 837w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>You can find the complete report here: <a href="https://www.webpagetest.org/result/181127_2A_bea6941dcd20d38ab54c29409fca9363/">https://www.webpagetest.org/result/181127_2A_bea6941dcd20d38ab54c29409fca9363/</a>.</p>
<p>The post <a href="https://blogit.create.pt/andresantos/2018/11/27/straight-as-in-webpagetest-with-umbraco/">Straight A&#8217;s in WebPagetest with Umbraco</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andresantos/2018/11/27/straight-as-in-webpagetest-with-umbraco/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Optimizing a VM for SharePoint 2010</title>
		<link>https://blogit.create.pt/andrevala/2010/03/06/optimizing-a-vm-for-sharepoint-2010/</link>
					<comments>https://blogit.create.pt/andrevala/2010/03/06/optimizing-a-vm-for-sharepoint-2010/#respond</comments>
		
		<dc:creator><![CDATA[André Vala]]></dc:creator>
		<pubDate>Sat, 06 Mar 2010 11:38:39 +0000</pubDate>
				<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[SharePoint 2010]]></category>
		<category><![CDATA[SharePoint]]></category>
		<guid isPermaLink="false">http://blogcreate.azurewebsites.net/andrevala/?p=401</guid>

					<description><![CDATA[<p>Creating an optimized SharePoint development environment was not an easy task with Sharepoint 2007, but it’s even harder with the new SharePoint 2010. The new version has a lot more features but, because of that, it’s also much more resource demanding, and that will make you sweat when building a new virtual machine to perform [&#8230;]</p>
<p>The post <a href="https://blogit.create.pt/andrevala/2010/03/06/optimizing-a-vm-for-sharepoint-2010/">Optimizing a VM for SharePoint 2010</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Creating an optimized SharePoint development environment was not an easy task with Sharepoint 2007, but it’s even harder with the new SharePoint 2010. The new version has a lot more features but, because of that, it’s also much more resource demanding, and that will make you sweat when building a new virtual machine to perform well on a laptop.</p>
<p>Following Raul’s post on <a href="http://blogit.create.pt/blogs/raulribeiro/archive/2010/02/25/SharePoint-2010-Tips-for-Performance.aspx" target="_blank">SharePoint 2010 Tips for Performance</a>, and because there seems to be a lot of people in the community facing the same issues I have, I&#8217;ll be describing in this article some recommendations and best practices that I’ve been collecting here and there.</p>
<p>Some of these recommendations apply not only to development virtual machines, but also to non virtualized production servers.</p>
<h3>Creating the Virtual Machine</h3>
<p>When creating the virtual machine, you should take the following hardware requirements into account:</p>
<ul>
<li>Allow your virtual machine to use <strong>all CPU cores</strong> available in the host</li>
<li>Allow your virtual machine, at least, <strong>4GB</strong> of RAM</li>
<li>Place your virtual machine in the <strong>fastest hard drive</strong> of the computer</li>
<li>Use <strong>e-Sata</strong> external drives because USB 2.0 and FireWire are too slow</li>
<li>Use <strong>7200 RPM</strong> drives or, ideally, <strong>SSD</strong> drives</li>
</ul>
<p>To avoid waste of resources, configure your VM and turn off everything you don’t need:</p>
<ul>
<li>CD Drive</li>
<li>USB Support</li>
<li>Printer Support</li>
</ul>
<p>Additionally, access the BIOS for the VM and disable the serial and parallel ports.</p>
<h3>Optimizing the Operating System</h3>
<p>The operating system to use is <strong>Windows Server 2008 R2 64-bits</strong>. The <em>standard<strong> </strong></em>edition is enough for a development environment, but be sure to check out the other versions in case you need some feature that is only present in the <em>enterprise</em> version.</p>
<p>In a <strong>development environment</strong>, there are several optimizations that can help you free some resources:</p>
<ul>
<li>In the network configuration options, uninstall the <strong>QoS Packet Scheduler</strong> and the <strong>Link Layer Topology Discovery</strong> components, and uncheck <strong>IPv6</strong>.</li>
<li>Turn off the <strong>Windows Firewall</strong>.</li>
<li>In the <em>Computer</em> properties <em>&gt; Advanced &gt; Performance Options &gt; Visual Effects</em>, select the option <strong>Adjust for best performance</strong>.</li>
<li>In the <em>Control Panel &gt; Hardware &gt; Sound</em>, don’t turn on the <strong>Windows Audio Service</strong> and select <strong>No Sounds</strong> as the <em>Sound Scheme</em>.</li>
<li>Turn off <strong>IE ESC</strong> for both administrators and users</li>
</ul>
<p>The <em>pagefile</em> is also a possible optimization target:</p>
<ul>
<li>If possible, place it in a disk different from the OS disk</li>
<li>Define the pagefile initial dimension to be the amount of RAM of the machine, and the final dimension to be the triple of the amount of RAM of the machine (if you have enough disk space)</li>
</ul>
<p>Whenever possible, it is a good idea to defragment the disks before shutting down the machine (this also applies to the host machine).</p>
<h3>Optimizing SQL Server</h3>
<p>SQL Server is where SharePoint stores all the data and, for that reason, is one of the main causes of the high resource consumption. You should use <strong>SQL Server 2008 64-bits SP1 with CU2</strong> (or higher) or, ideally, <strong>SQL Server 2008 R2 64-bits</strong>. The important thing here is that it’s <strong>Enterprise</strong> or <strong>Developer</strong> edition.</p>
<h4>Storage</h4>
<p>One of the main optimization points for SQL Server is storage, that is, disk performance. To assure the best possible performance, you should create additional virtual disks so that you can separate in different disks:</p>
<ul>
<li>SQL Server’s <strong>TempDB</strong></li>
<li>Database <strong>data files</strong> (.mdf e .ldf)</li>
<li>Database <strong>log files</strong> (.ldf) </li>
</ul>
<p>These disks should have the following characteristics: </p>
<ul>
<li>Single file</li>
<li><strong>Pre-allocated</strong> size</li>
<li>NTFS Formatted using <strong>64K blocks</strong></li>
</ul>
<p>Ideally, each of these virtual disks should be stored in a <strong>distinct physical disk</strong>, but when you intend to use the virtual machine in a laptop, it’s not easy to carry 3 or more external hard drives in your backpack.</p>
<p>Anyway, even if you don’t have enough physical hard drives, the virtual disks should be stored in physical disks according to their speed, using the following order: </p>
<ul>
<li>TempDB disk (fastest) </li>
<li>Log file disk</li>
<li>Data file disk</li>
<li>System disk (slowest)</li>
</ul>
<h4>Data Files</h4>
<p>By default, SQL Server specifies small sizes for the data files and uses small auto-growth sizes to save disk space. However, the auto-growth operation as well as the fact that they grow in small blocks, causes performance degradation as well as fragmentation of the files in the disk.</p>
<p>To increase the performance you should: </p>
<ul>
<li>Use more than one data file in the primary file group for the TempDB, search DBs and content DBs of SharPoint.</li>
<li>Always use, at most, one data file for each CPU core of the system. Ideally, you should use one data file for each 2 CPU cores. </li>
<li>If possible, store the data files in different physical disks (very hard for a development environment).</li>
<li>Pre-allocate all data files, including the data files for <strong>TempDB</strong>. </li>
<li>The data files for each DB should be equally sized.</li>
<li>Specify a size for the data files that is enough to avoid auto-growth (for the TempDB, the total size should be 10% of the total size of the largest DB of the system).</li>
<li>Specify data file growth size to be <strong>256MB</strong> or <strong>512MB</strong></li>
</ul>
<h4>Lock Pages in Memory</h4>
<p>Another important configuration, is to authorize SQL Server to use the <strong>Lock Pages in Memory</strong> feature to keep Windows from unloading the memory pages that might still be needed, leading to a performance degradation (more information in: <a href="http://support.microsoft.com/kb/918483">http://support.microsoft.com/kb/918483</a>).</p>
<h3>Optimizing SharePoint</h3>
<p>Use SharePoint’s complete installation, instead of the stand alone installation, so that it doesn’t install a new SQL Server instance or automatically configures the Farm.</p>
<p>After the installation, configure SharePoint turning on only the features that you absolutely need. Each unnecessary service you turn on will mean less memory and CPU time available for the services that really matter. </p>
<p>The post <a href="https://blogit.create.pt/andrevala/2010/03/06/optimizing-a-vm-for-sharepoint-2010/">Optimizing a VM for SharePoint 2010</a> appeared first on <a href="https://blogit.create.pt">Blog IT</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blogit.create.pt/andrevala/2010/03/06/optimizing-a-vm-for-sharepoint-2010/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
