Let’s make sure that your new ColdFusion app doesn’t crash immediately after launch – by effective load testing.
In this article, we will look at 4 reasons why load test ColdFusion Apps. You will learn:
- Pick a load testing tool
- Write testing scripts that simulate real life
- Assess the results of the test
- Rinse and repeat your tests and fixes
If you don’t plan ahead with load testing when too many users hit your newborn app at the same time, then it can become very slow or even crash your CF server. Leading to upset users, lost revenue for your company, and serious egg on the faces of everyone in your IT department.
In performance tuning circles, we call it “The Wall”. It’s hard to see it coming. But you’ll know when you’ve hit it.
“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.
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” – my colleague Mike Brunt (CF performance expert) says.
It’s a wall similar to the one faced by marathon runners. It’s when your body decides to call it quits and all systems fall apart.
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’s look in more detail at why you should load test.
Why Do You Need To Load Test ColdFusion Apps?
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.
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.
- Crashes can spook users, leading them to jump to your competitors.
- It will slow down your company’s critical operations that are dependent upon the app. This all leads to added costs.
- Inevitably, you will have to call in the fire brigade to squeeze out new load capacity.
- Perhaps worst of all: Bugs and server crashes will chase away customers and kill productivity. This, in tandem, hurts your company’s image.
With proper load testing, you can discover your app’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!
Load testing your code and app is the most effective, least costly way to expose any weaknesses or mistakes in your work.
How To Easily Load Test ColdFusion Apps and Make It A Routine
1. Pick a load testing tool
Start with a load testing tool such as the free open-source Apache JMeter. 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 “thinking time”, just as humans delay between clicks or form submits.
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.
2. Write Testing Scripts That Simulate Real Life
Write a testing script that mimics real users interacting with your web app.
Make sure the “users” 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.
Turn up the load of simulated users through 3 levels:
- Ramp up the number of users until your app slows down.
- Take it to the normal expected number of users and see how it performs.
- Then get “a little bit naughty” – keep ramping up users until it finally breaks the server with a total crash. This is called a stress test and lets you find the ultimate limits to your code, architecture, and hardware setup.
Note you should have fixed all regular bugs before you start load testing. I wrote about Testing and automated testing to help with that.
3. Assess The Results Of The Test
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.
Load issues are usually caused by a combination of factors:
- Software configuration issues, either for CF, IIS, JVM, databases
- Poorly optimized software code that cannot handle an influx of activity
- Badly designed database tables, indices, or queries
- Speed issues with external services called by CFHTTP or REST API calls
- Poor network configurations which get bogged down by increased demand
- Incorrectly configured clustering and load balancing
- Insufficient hardware (CPU, RAM, and disk space), which cannot meet the overall demands of running the app at peak load
You can learn more about fixing issues in this podcast interview I did with CF scaling expert Mike Collins.
I use a performance monitoring tool such as FusionReactor during load tests to make tracking down the cause of problems easier.
4. Rinse and Repeat Your Tests and Fixes
Keep load testing your app until:
- You’re sure the expected number of users won’t slow down your app.
- You can handle reasonable surges in users, of say 100% above the expected load.
- 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.
The Long-term Benefits of Load Test ColdFusion Apps
Load testing remains one of the more overlooked aspects of CF development. Many treat it as an afterthought. But it’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.
Run tests that push the limits of your web apps and servers. This stress test will show your app’s breaking point, which will help you spot trouble ahead of time.
Be optimistic! Load testing is a part of coding where not planning for failure leads to ultimate failure after launch.
About the Author
Michaela Light is the host of the CF Alive Podcast and has interviewed more than 100 ColdFusion experts. In each interview, she asks “What Would It Take to make CF more alive this year?” 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 TeraTech 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.