7 Steps To Get The Best Coldfusion Web Application Performance
Michaela Light
Expert ColdFusion help for CIOs | CF Maintain, Modernize, Develop, Secure | CF Alive podcast | Author | Speaker | CEO
Learn about the simple performance tuning tricks and habits that will help you get the best ColdFusion web application performance and save your company hours of time and precious resources, all the while saving some money along the way.
How much is “slow” costing your company?
In the cutthroat world of IT, seconds mean dollars. A slow-loading web application can send users running. If you’re lucky, they’ll simply bounce off your site. Or even worse — they’ll turn to your competitors. The slowdown doesn’t need to be big to have an effect.
Sometimes, you have to roll up your sleeves and dig into the code to tune your app.
Let’s say a specific line of your Structured Query Language, or SQL, takes 100 milliseconds to execute and it runs 200 times an hour. In one year, that single line of code has consumed 48 hours of your company’s resources and users’ time.
And that’s just one line of code which could be a tad quicker.
Imagine if an employee or developer spent 48 hours of his year doing a single menial task. Wouldn’t you want to introduce some efficiencies? Of course, you would. You’d likely subject that employee to what we call “performance tuning.”
Fortunately, ColdFusion is ready-made to shave precious seconds off your app. Some simple performance tuning tricks and habits will help save your company hours of time and precious resources, all the while saving some money along the way.
In this article, we will:
- Explain what performance tuning is.
- Show how it can help.
- Show some simple steps your developers can implement quickly to speed up your web application.
What is performance tuning in SQL?
Is your web application slowing down? Lucky you! Reduced speed is often the cost of popularity.
As demand for an application grows, its resources are taxed. The gears of the machine gum up and slow down. Alas, success has its downsides.
Most systems or networks have an ideal performance capacity, something akin to an “in shape” athlete playing at his or her highest level. Increased use and greater loads are weights strapped to that athlete’s legs and back. Performance tuning is the counter to those weights.
Done properly, performance tuning can rejuvenate a slowing application.
So how does one do it?
Follow these simple steps to optimize your database and its functions:
1. Clean up your SQL
Structured Query Language, or SQL, is the circulatory system of your web application. What you want your application to do, and where you want it to go, relies almost-exclusively on well-structured SQL. ColdFusion performance maestro Gert Franz has a laundry list of performance tuning tips and tricks, which he kindly stuffed into a presentation available to everyone. Franz’s presentation is rather in-depth, and outside the realm of mere mortal minds (he studied astrophysics before switching to IT). Yet it’s worth the time for any developer trying performance tuning in SQL at a granular level. Here are the main takeaways:
- Get rid of as many queries as you can afford to. While this may seem counterintuitive, many apps are laced with unnecessary queries and duplicates which can easily be cut.
- Avoid queries of queries . Layering like this has a multiplicative effect on run time, and can be easily worked around.
- Avoid ; use arrays instead. Lists offer only sequential access to a bit of data, creating a set of built-in hurdles to get to whatever your application needs.
- Minimize database calls — they’re time and resource hogs.
2. Find the garbage collection sweet spot
“Garbage collection” is tossing aside an app’s leftover parts and scraps of code. ColdFusion expert Mike Brunt writes in his blog that he uses garbage collection as a barometer for performance; to see the general state of things within the “engine room.” Done too often, garbage collection can rob an application of precious resources. Done too little, those half-used and discarded bits of code can accumulate and cause havoc. Finding an ideal middle ground will go a long way and will keep your application running smoothly.
3. Expect success when modeling your database
Too often, companies underestimate their own potential. Brunt says he often finds poorly-planned data models to be a common culprit behind slowing applications. Give your team time to think big and aim high, then design a database to match those aspirations. “Think of the database as a heart,” Brunt writes . “If it falters or fails, your application will suffer the same fate.” Humility isn’t a bad thing, but it can hurt your bottom line.
4. Ongoing maintenance
Brunt suggests establishing good habits within your database, namely its indexes. Efficiency is key here, by establishing table indexing that processes data quickly. Then, as the application grows and evolves, keep reviewing those indexes and make changes as necessary. Performance tuning in SQL is more than just periodically digging under the hood. Preventative work can spell the difference between a minor tweak and an all-hands-on-deck freakout. By keeping an eye on your indexes, as well as other components of your web application, you’ll save yourself headaches down the line.
5. Check your hardware
Make sure your hardware is optimized, especially hard drives. CIOs too often focus on glitzy headline numbers, like CPU clock speed and RAM. These are, of course, important. Adobe suggests making sure CPUs, memory and hard disks are as fast as possible. But it’s actually poorly-configured hard drives which could cost precious seconds.
6. Monitor your logs and metrics
Logs give an accurate picture of what your app is doing. This can be made easy by using ColdFusion’s built-in tools, including Server Monitor. Don’t forget CF Stat though. Brunt uses the old ColdFusion standby to pull up insightful information not offered by its newer, younger variants.
For example, while Server Monitor may paint a rosy picture of an app’s state, CF Stat might show a high number of requests being turned down.
Another option is Fusion Reactor , a solution which may cost a pretty penny but cuts down on diagnostic time.
7. Load test as often as you can
Preventative maintenance and nifty performance tuning tricks can only go so far. You need to test the effectiveness of your performance tuning. Load testing means simulating real-world usage and testing capacity. This can show your progress and uncover unseen inefficiencies. “It’s the only way to find out what’s really going to happen when you’re out in the wild.” — Mike Brunt
Load test as often as you can, overestimating your application’s potential usage. Make sure it’s randomized to mimic real-world use. You’ll quickly find bottlenecks that are slowing the application down. Ideally, you should run a load test after taking one or a few performance tuning steps, to see what sort of effect they had and what else needs to be fixed.
These tips, taken as a whole and directed by an adept CIO, can go a long way in helping a web application perform at its highest possible level.
ColdFusion tackles one of the easily-ignored culprits in a web-app’s performance: speed. CFML’s built-in tools, as well as some tweaks, could help free precious resources and fatten your company’s bottom line. Because as we all know, performance matters .
And to continue learning how to make your ColdFusion apps more modern and alive, I encourage you to download our free ColdFusion Alive Best Practices Checklist.
Because… perhaps you are responsible for a mission-critical or revenue-generating CF application that you don’t trust 100%, where implementing new features is a painful ad-hoc process with slow turnaround even for simple requests.
What if you have no contingency plan for a sudden developer departure or a server outage? Perhaps every time a new freelancer works on your site, something breaks. Or your application availability, security, and reliability are poor.
And if you are depending on ColdFusion for your job, then you can’t afford to let your CF development methods die on the vine.
You’re making a high-stakes bet that everything is going to be OK using the same old app creation ways in that one language — forever.
All it would take is for your fellow CF developer to quit or for your CIO to decide to leave the (falsely) perceived sinking ship of CFML and you could lose everything-your project, your hard-won CF skills, and possibly even your job.
Luckily, there are a number of simple, logical steps you can take now to protect yourself from these obvious risks.
No Brainer ColdFusion Best Practices to Ensure You Thrive No Matter What Happens Next
ColdFusion Alive Best Practices Checklist
Modern ColdFusion development best practices that reduce stress, inefficiency, project lifecycle costs while simultaneously increasing project velocity and innovation.
Easily create a consistent server architecture across development, testing, and production
A modern test environment to prevent bugs from spreading
√ Automated continuous integration tools that work well with CF
A portable development environment baked into your codebase… for free!
Learn about these and many more strategies in our free ColdFusion Alive Best Practices Checklist.
Originally published at https://teratech.com on June 28, 2019.