Oh, the horror! Oh my, the agony!
Waiting for your device to make progress as it tries to load an app or site. Delays are the death knell of life in the tech world and cause major havoc to your company’s bottom line.
Does this sound familiar for all the wrong reasons?
If your company’s app has been plagued by slow load times and lackluster performance, don’t worry! ColdFusion is by nature designed for speed — and it doesn’t take long to turn a tortoise into a hare using Adobe’s development platform.
“Slow” can have a myriad of causes, from issues in the code itself to issues with your server configuration. You’ll be best served by figuring out what’s causing your app’s snail’s pace, and finding a way to fix it.
In this article, you will learn:
- What causes “slow”.
- How to prevent your app from slowing down.
- How you can speed up your apps via “performance tuning”.
Let’s talk about it!
Slow Isn’t Permanent — You Can Fix It
I once had an introductory meeting with a client who guided me over to a desktop and knocked out a sequence of keystrokes to open an internal payroll app.
“Ok, so while we wait for this to start, let me tell you what’s wrong,” he said.
I stopped him. “Wait for the app to open?! How long will we wait?”
“A bit. Why? Is that a problem?”
The exchange itself left me dumbfounded.
Some CIOs aren’t even aware their apps and sites are slower than molasses. Their perception may be off, perverted by a poor frame of reference.
Just like a plane flying a mile in the air doesn’t appear to be moving as swiftly.
Or a turtle who never encounters a hare. They don’t know they’re slow, because slow is all they know.
And it’s a costly mistake to make! In today’s tech world, “slow” is measured in milliseconds, not minutes.
Let’s say a specific line of code in your app takes 500 milliseconds to run, and it runs 100 times per hour. That one line of code consumes 120 hours of your company’s resources and energy every year.
Now pass that 120 hours along to your customers and users and it adds up to a lot of cash!
What Causes “Slow”
There are several reasons your ColdFusion app may act lethargic. Diagnosing the cause of the slowdown is the first step to fixing it.
There are a few ways to find out what’s causing the holdup.
Check your logs and metrics
ColdFusion offers a statistical breakdown of your app’s behavior “behind the scenes.” These offer a snapshot of the state of your app and its interactions with system hardware.
CF’s built-in tools, such as Server Monitor and CF Stat can also help you assess what’s happening “behind the scenes.” These two used in tandem can be an effective way to troubleshoot an app at a granular level.
There are also third-party products, such as Fusion Reactor — a costly but often worthwhile solution. Deploying these sorts of tools wisely and frequently can help pinpoint the exact cause of your app’s slowdown.
There’s one key thing to remember when addressing speed issues: you may be a victim of your own success. “Slow” may not be a symptom of poor design, but poor planning.
Increased demand hogs more resources than your developers may have expected, causing a bottleneck of users. To put it simply, your ColdFusion application may be too popular for its own good. Your system’s ideal performance capacity has been thrown off by the increase in use.
It will require tuning to get things back into normal shape. They call this “performance tuning.”
Speed Up Your Apps Via “Performance Tuning”
Your app’s “Structure Query Language” or “SQL” serves as the go-between for your commands and the server’s contents.
Getting your SQL in order can help remove a tangle of needless extra energy spent on poorly-structured queries.
Gert Franz, a man who was once so bored with astrophysics he became a developer, created a presentation on performance tuning your SQL, which should become a staple in every ColdFusion developer’s reading diet.
Here is the abridged version:
- Limit queries of any kind, especially queries of queries. Though they may be the main vehicle for accomplishing anything in SQL, they’re still resource hogs that should be limited.
- Get creative when seeking efficiency! Layering queries can only gum up your works and slow things down.
- No lists!!! Arrays offer a much faster way of accomplishing the same goal.
- Keep your database calls at bay.
- Keep garbage collection to an efficient minimum. Too much hogs system resources. Too little clogs system resources.
Check the full presentation and this classic episode on ColdFusion Alive about debugging.
There’s also another key component to any performance tuning protocols: Load test your apps as often as possible.
- Simulate real-world conditions to find out how much traffic your app can withstand “out in the wild.” This can help show blind spots and potential future trouble well ahead of time.
- It will also test your app’s mettle to find out what it would take for a slowdown and eventually a crash. This is the point, even though it may seem counterintuitive: you want to break your app.
- Be sure to repeat this process. Run a quick load test after every performance tuning to see how much progress you’ve made.
How To Prevent Your App From Slowing Down
I’ve never dealt with a client who said, “We’ve been taking care of this before it becomes a problem.” Seems obvious why, when you think about it. If you include a due diligence routine in your workflow that’s dedicated purely to preventative maintenance and upgrades, you’ll rarely find yourself addressing a big problem. What’s the key?
Be ready to evolve. The app you create today is built for the hardware which made it. But as it changes, your app’s architecture and hardware will have to change with it.
This includes four key steps:
- Model your databases with success in mind.
- Create data models that assume a reasonable level of popularity for your app. Then add a percentage atop that. This will give you a lot of leeway and extra load in the fortunate case that your app’s user base explodes.
- Maintain and upgrade your hardware.
- Drives and CPUs grow slow over time and deteriorate. Keep them fresh.
- Adobe’s guidelines suggest using the fastest specs for CPUs, memory, and hard disks. You can find some wiggle room in these settings. Don’t break the bank, but you also shouldn’t be stingy about the components and hardware your company uses.
- Set up consistent maintenance habits.
- Load test with every major change.
- Monitor your database indexes. Find a table indexing model that processes data quickly.
- Repeat these maintenance steps as the application evolves and make changes as necessary.
Slow-loading pages can increase user abandonment, taking a direct bite out of your company’s bottom line. Learning a few tips and tricks to keep your application or server moving along swiftly will help keep users engaged — and still filling your company’s coffers.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 20 years. She founded TeraTech in 1989. The company specializes in ColdFusion application development, security and optimization. She has also founded the CFUnited Conference and runs the annual State of the CF Union Survey.
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
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.