Why Load Test ColdFusion Apps (4 Reasons)
Tags: coldfusion, cfml, loadtest
Published: 2021-02-02 10:09:48

<p><span style="font-weight: 400;">Let&rsquo;s make sure that your new ColdFusion app doesn&rsquo;t crash immediately after launch &ndash; by effective load testing.</span></p>
<p><span style="font-weight: 400;">In this article, we will look at 4 reasons why load test ColdFusion Apps. You will learn:</span></p>
<p><a href="#Why-Do-You-Need-To-Load-Test-?"><span style="font-weight: 400;">Why do you need to load test?</span></a></p>
<p><a href="#How-To-Easily-Load-Test-And-Make-It-A-Routine"><span style="font-weight: 400;">How to Easily Load Test and Make it a Routine</span></a></p>
<ol>
<li><a href="#Pick-A-Load-Testing-Tool"><span style="font-weight: 400;"> Pick a load testing tool</span></a></li>
<li><a href="#Write-Testing-Scripts-That-Simulate-Real-Life"><span style="font-weight: 400;"> Write testing scripts that simulate real life</span></a></li>
<li><a href="#Assess-The-Results-Of-The-Test"><span style="font-weight: 400;"> Assess the results of the test</span></a></li>
<li><a href="#Rinse-And-Repeat-Your-Tests-And-Fixes"><span style="font-weight: 400;"> Rinse and repeat your tests and fixes</span></a></li>
</ol>
<p><a href="#The-Long-Term-Benefits-Of-Load-Testing"><span style="font-weight: 400;">The Long-term Benefits of Load Testing</span></a></p>
<p><a href="#About-The-Author"><span style="font-weight: 400;">About the Author</span></a></p>
<p><span style="font-weight: 400;">If you don&rsquo;t plan ahead with load testing when too many users hit your newborn app at the same time, then it can become </span><b>very slow or even crash your CF server</b><span style="font-weight: 400;">. Leading to upset users, lost revenue for your company, and serious egg on the faces of everyone in your IT department. </span></p>
<p><span style="font-weight: 400;">In performance tuning circles, we call it &ldquo;</span><b>The Wall</b><span style="font-weight: 400;">&rdquo;. It&rsquo;s hard to see it coming. But you&rsquo;ll know when you&rsquo;ve hit it.</span></p>
<p><i><span style="font-weight: 400;">&ldquo;The Wall, in web applications, is that perfect storm of occurrences that suddenly, and within seconds, brings a web application to its knees. It is almost always caused by one thing: a stacking up of all available ColdFusion application threads. Which to be fair, is preceded, rather quickly, with a slow down in performance.&nbsp;</span></i></p>
<p><i><span style="font-weight: 400;">There can be many reasons, a successful marketing campaign, a major event, an unexpectedly successful launch. Whatever the cause, it is possible to architect and build infrastructure that can cope with any load&rdquo;</span></i><span style="font-weight: 400;">&nbsp;&ndash; my colleague Mike Brunt (CF performance expert) </span><a href="http://www.cfwhisperer.com/post.cfm/the-wall-ouch" target="_blank" rel="noopener noreferrer"><span style="font-weight: 400;">says</span></a><span style="font-weight: 400;">.</span></p>
<p><span id="Why-Do-You-Need-To-Load-Test-?" style="font-weight: 400;">It&rsquo;s a wall similar to the one faced by marathon runners. It&rsquo;s when your body decides to call it quits and all systems fall apart.</span></p>
<p><span style="font-weight: 400;">Fortunately, you can avoid The Wall with load testing. Done properly, it can save you and your company a lot of time, money, and frazzled nerves. Let&rsquo;s look in more detail at why you should load test.</span></p>
<h2><strong>Why Do You Need To Load Test ColdFusion Apps?</strong></h2>
<p><span style="font-weight: 400;">No ColdFusion team wants their new app to crash after launch. But sometimes under pressure, or due to lack of knowledge, you launch it too soon. Before it has been stress-tested under real load conditions.&nbsp;</span></p>
<p><span style="font-weight: 400;">There are a few nasty side-effects of poorly-planned app launches that lead to crashes. This is typically caused by a sudden influx of traffic or users, spiking demand at times when resources are limited. It can bring your web app crashing down. It happens when you are stacking up all available application threads that collapse under their own weight.</span></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Crashes can spook users, leading them to jump to your competitors.&nbsp;</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">It will slow down your company&rsquo;s critical operations that are dependent upon the app. This all leads to added costs.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Inevitably, you will have to call in the fire brigade to squeeze out new load capacity.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Perhaps worst of all: Bugs and server crashes will chase away customers and kill productivity. This, in tandem, hurts your company&rsquo;s image.&nbsp;</span></li>
</ul>
<p><span id="How-To-Easily-Load-Test-And-Make-It-A-Routine" style="font-weight: 400;">With proper load testing, you can discover your app&rsquo;s weak points before the curtain opens on your launch to a live audience. With the right set up, you can enjoy pushing your app and server architecture to the limit, breaking them, and then fixing the resulting mess. All in a consequence-free setting. Makes me feel like a kid again!</span></p>
<p><span id="Pick-A-Load-Testing-Tool" style="font-weight: 400;">Load testing your code and app is the most effective, least costly way to expose any weaknesses or mistakes in your work. </span></p>
<h2><strong>How To Easily Load Test ColdFusion Apps and Make It A Routine</strong></h2>
<h4><strong>1. Pick a load testing tool</strong></h4>
<p><span id="Write-Testing-Scripts-That-Simulate-Real-Life" style="font-weight: 400;">Start with a load testing tool such as the free open-source </span><a href="https://jmeter.apache.org/" target="_blank" rel="noopener noreferrer"><span style="font-weight: 400;">Apache JMeter</span></a><span style="font-weight: 400;">. It lets you write and playback user scripts that simulate real users running your app. You can include userIDs/passwords or other user data from data files to make the simulated users more realistic. And include random &ldquo;thinking time&rdquo;, just as humans delay between clicks or form submits.&nbsp;</span></p>
<p><span style="font-weight: 400;">As you progress in load testing, you can consider the many paid load testing tools which add more features, with prices ranging from $100 to $100,000.</span></p>
<h4><strong>2. Write Testing Scripts That Simulate Real Life</strong></h4>
<p><span style="font-weight: 400;">Write a testing script that mimics real users interacting with your web app. </span><span style="font-weight: 400;"><br>
</span><span style="font-weight: 400;">Make sure the &ldquo;users&rdquo; are as active and numerous as real-world users would be. They should be clicking, updating, refreshing, downloading, and generally frantically chewing over every inch of your app.</span></p>
<p><span style="font-weight: 400;">Turn up the load of simulated users through 3 levels:</span></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Ramp up the number of users until your app slows down.&nbsp;</span></li>
<li style="font-weight: 400;" aria-level="1"><span id="Assess-The-Results-Of-The-Test" style="font-weight: 400;">Take it to the normal expected number of users and see how it performs.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Then get &ldquo;a little bit naughty&rdquo; &ndash; keep ramping up users until it finally breaks the server with a total crash. This is called a </span><b>stress test</b><span style="font-weight: 400;"> and lets you find the ultimate limits to your code, architecture, and hardware setup.&nbsp;</span></li>
</ul>
<p><span style="font-weight: 400;">Note you should have fixed all regular bugs before you start load testing. I wrote about </span><a href="https://teratech.com/thorough-test-coldfusion-web-applications/" target="_blank" rel="noopener noreferrer"><span style="font-weight: 400;">Testing and automated testing</span></a><span style="font-weight: 400;"> to help with that.</span></p>
<h4><strong>3. Assess The Results Of The Test</strong></h4>
<p><span style="font-weight: 400;">Now that your digital army of simulated users has done a great job of slowing down or crashing your app, you can get to work in analyzing why it happened.&nbsp;</span></p>
<p><span style="font-weight: 400;">Load issues are usually caused by a combination of factors:</span></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Software configuration issues, either for CF, IIS, JVM, databases</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Poorly optimized software code that cannot handle an influx of activity</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Badly designed database tables, indices, or queries</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Speed issues with external services called by CFHTTP or REST API calls</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Poor network configurations which get bogged down by increased demand</span></li>
<li style="font-weight: 400;" aria-level="1"><span id="Rinse-And-Repeat-Your-Tests-And-Fixes" style="font-weight: 400;">Incorrectly configured clustering and load balancing</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Insufficient hardware (CPU, RAM, and disk space), which cannot meet the overall demands of running the app at peak load</span></li>
</ul>
<p><span style="font-weight: 400;">You can learn more about fixing issues in this podcast interview I did with </span><a href="https://teratech.com/podcast/scaling-your-coldfusion-applications-clusters-containers-and-load-tips-with-mike-collins/" target="_blank" rel="noopener noreferrer"><span style="font-weight: 400;">CF scaling expert Mike Collins</span></a><span style="font-weight: 400;">.</span></p>
<p><span style="font-weight: 400;">I use a performance monitoring tool such as FusionReactor during load tests to make tracking down the cause of problems easier.</span></p>
<h4><strong>4. Rinse and Repeat Your Tests and Fixes</strong></h4>
<p><span style="font-weight: 400;">Keep load testing your app until:</span></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span id="The-Long-Term-Benefits-Of-Load-Testing" style="font-weight: 400;">You&rsquo;re sure the expected number of users won&rsquo;t slow down your app.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">You can handle reasonable surges in users, of say 100% above the expected load.&nbsp;</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">You are comfortable that the point that your server crashes under load is a high number of users. And given user growth predictions, that it is far enough into the future that you could buy extra hardware to prevent problems before they happen.</span></li>
</ul>
<h2><strong>The Long-term Benefits of Load Test ColdFusion Apps</strong></h2>
<p><span id="About-The-Author" style="font-weight: 400;">Load testing remains one of the more overlooked aspects of CF development. Many treat it as an afterthought. But it&rsquo;s an early decision that could have long-term ramifications for the success of your web app, as well as the financial health of your company. Load test properly, or it could cost you big time. In the worst case, it can cause a company to go out of business.</span></p>
<p><span style="font-weight: 400;">Run tests that push the limits of your web apps and servers. This stress test will show your app&rsquo;s breaking point, which will help you spot trouble ahead of time.</span></p>
<p><span style="font-weight: 400;">Be optimistic! Load testing is a part of coding where not planning for failure leads to ultimate failure after launch.</span></p>
<h2><strong>About the Author</strong></h2>
<p><img loading="lazy" class="alignleft wp-image-61797 size-full" src="http://www.fusion-reactor.com/wp-content/uploads/2021/01/Screenshot-2021-01-21-at-09.42.43.png" alt="Why Load Test ColdFusion Apps (4 Reasons), FusionReactor" width="125" height="176" srcset="http://www.fusion-reactor.com/wp-content/uploads/2021/01/Screenshot-2021-01-21-at-09.42.43.png 125w, http://www.fusion-reactor.com/wp-content/uploads/2021/01/Screenshot-2021-01-21-at-09.42.43-107x150.png 107w" sizes="(max-width: 125px) 100vw, 125px"></p>
<p><strong><b>Michaela Light</b><span style="font-weight: 400;"> is the host of the </span><a href="https://teratech.com/podcast/" target="_blank" rel="noopener noreferrer"><span style="font-weight: 400;">CF Alive Podcast</span></a><span style="font-weight: 400;"> and has interviewed more than 100 ColdFusion experts. In each interview, she asks &ldquo;What Would It Take to make CF more alive this year?&rdquo; The answers still inspire her to continue to write and interview new speakers. Michaela has been programming in ColdFusion for more than 25 years. She founded </span><a href="https://teratech.com/" target="_blank" rel="noopener noreferrer"><span style="font-weight: 400;">TeraTech </span></a><span style="font-weight: 400;">in 1989. The company specializes in ColdFusion maintenance, application development, security, and optimization. She has also founded the CFUnited Conference and runs the annual State of the CF Union Survey.</span>&nbsp;</strong></p>
</div></div></div></div></div></div></div></section>