Click here to close now.




















Welcome!

Java IoT Authors: Elizabeth White, David Sprott, Liz McMillan, Dana Gardner, Sematext Blog

Related Topics: Java IoT

Java IoT: Article

Go Fast It Runs Too Slow

"Speed Is as Speed Does"

Go fast, it runs too slow, you've got to make the number show. Diddle de bop, da la de doop, sitting around and feeling groovy.

Speed Is as Speed Does
Many moons ago I was working on a project that had to be sped up and we had the benefit of a very experienced consultant to help us out. Fresh from his business-class flight and clutching his pay-as-you-go expense account lunch, our management team eagerly led him over to where our assembled developers waited in awe (and with a certain amount of natural coder-sapiens resistance to the hired gun who'd come to town to sheriff us).

Like a surgeon approaching a sick patient we expected a briefcase to be opened revealing dozens of tools for analyzing memory leakage, profiling garbage collection across multiple threads, searching out deadlocks and everything else we assumed was slowing down the program. Instead all he produced was a simple red stopwatch.

All that matters to the user is how long a given scenario takes and whether it's perceived as slow or not. The first thing to do was to identify which tasks were too slow, figure out what response time would be acceptable, and then keep working back against that benchmark.

Apples and Apples
The idea is to focus on real user scenarios and their actual end-to-end response times. Instead of our zippy high-end boxes, dust off older, slower machines and dedicate them to doing the benchmarks. Us spoiled developers often run the latest wizzo kit and don't appreciate the realities of the boxes our code actually runs (or walks on) in the field.

Look Under the Hood
Having identified the slow scenarios, the next step is to identify where the time is going. Probably no single tool can yield all that information, and techniques can vary from simple tracelogs of the current clock time at various stages in the program through to powerful local and total time method breakdowns. Garbage collection, file I/O, page faults, all need to be observed and understood.

Fix What's Broke, Forget What's Not
Looking at the analysis from the running application can yield a bunch of fix candidates. But rather than jumping in and starting to redesign everything, it's good to prove first that there will be a real benefit before doing any work. Like writing a unit test before programming, it may be better to create dummy fixes that simulate the corrected code without being functionally complete. The exercise might involve changing a method to hard coding a result instead of an expensive piece of computation, or putting data in a stale cache and running performance tests to see if the fancy auto-rebuilding dancing cache is really worth doing. Before creating a solution, you have to know there's a real problem as opposed to a perceived one you just feel like polishing. Patch fixes can be created for dummy fixes, applied and run against a full build on the benchmark box to see what affect they have and, by extrapolation, the benefit fully functional fixes will bring to the bottom line.

Optimize Code Paths
Sometimes single method calls result in an explosion of code where a leaf method is being executed thousands of times. With the execution time of the lowest-level method being gauged in fractions of milliseconds, this becomes significant. The solution is to rewrite the code path to avoid such a deluge. The change itself might not be particularly difficult but without a good tool to get the problem on the radar, perhaps as a result of an n squared or even n to the n algorithm, it might never even be considered a possible problem.

Minimize IO
One way to produce big performance improvements is to reduce the amount of file reads and writes and socket access. Some data needs to be re-read frequently because it's volatile, but objects such as icons or definition files are good candidates to access once and cache in library registries. Socket I/O is another place to look as well. We found that the problem with one application was in the latency of the conversation, not in the amount of data being sent across the wire. It was overcome by batching data packets together into larger-grained messages.

Cache Model Data
Using a cache to speed something up can be either a silver bullet or fool's gold. The latter is like someone who claims they get great mileage from their car by not driving it. If the program is fast enough to begin with, caches aren't needed, so the first port of call should be to see if there are other unexplored avenues to make things quicker. If a cache is required then it comes with the health warning that you not only have to build it, you need to know when the data you're caching might become stale.

Leave Your Assumptions at the Door
One of the most startling things about tuning a program is that sometimes a lot of fancy code that was initially designed to help performance isn't that useful. Ironically the clever algorithms might actually cause harm. While they may add nothing significant to the bottom line, they can make the code harder to read and understand and affect its maintainability. This is part of the philosophy behind the XP mantra "Make it work, make it right, make it fast." Until you know what's slow, don't try to make it faster.

More Stories By Joe Winchester

Joe Winchester, Editor-in-Chief of Java Developer's Journal, was formerly JDJ's longtime Desktop Technologies Editor and is a software developer working on development tools for IBM in Hursley, UK.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
SYS-CON Events announced today that HPM Networks will exhibit at the 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. For 20 years, HPM Networks has been integrating technology solutions that solve complex business challenges. HPM Networks has designed solutions for both SMB and enterprise customers throughout the San Francisco Bay Area.
For IoT to grow as quickly as analyst firms’ project, a lot is going to fall on developers to quickly bring applications to market. But the lack of a standard development platform threatens to slow growth and make application development more time consuming and costly, much like we’ve seen in the mobile space. In his session at @ThingsExpo, Mike Weiner, Product Manager of the Omega DevCloud with KORE Telematics Inc., discussed the evolving requirements for developers as IoT matures and conducted a live demonstration of how quickly application development can happen when the need to comply wit...
The Internet of Everything (IoE) brings together people, process, data and things to make networked connections more relevant and valuable than ever before – transforming information into knowledge and knowledge into wisdom. IoE creates new capabilities, richer experiences, and unprecedented opportunities to improve business and government operations, decision making and mission support capabilities.
Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at @ThingsExpo, James Kirkland, Red Hat's Chief Architect for the Internet of Things and Intelligent Systems, described how to revolutionize your archit...
MuleSoft has announced the findings of its 2015 Connectivity Benchmark Report on the adoption and business impact of APIs. The findings suggest traditional businesses are quickly evolving into "composable enterprises" built out of hundreds of connected software services, applications and devices. Most are embracing the Internet of Things (IoT) and microservices technologies like Docker. A majority are integrating wearables, like smart watches, and more than half plan to generate revenue with APIs within the next year.
Growth hacking is common for startups to make unheard-of progress in building their business. Career Hacks can help Geek Girls and those who support them (yes, that's you too, Dad!) to excel in this typically male-dominated world. Get ready to learn the facts: Is there a bias against women in the tech / developer communities? Why are women 50% of the workforce, but hold only 24% of the STEM or IT positions? Some beginnings of what to do about it! In her Opening Keynote at 16th Cloud Expo, Sandy Carter, IBM General Manager Cloud Ecosystem and Developers, and a Social Business Evangelist, d...
In his keynote at 16th Cloud Expo, Rodney Rogers, CEO of Virtustream, discussed the evolution of the company from inception to its recent acquisition by EMC – including personal insights, lessons learned (and some WTF moments) along the way. Learn how Virtustream’s unique approach of combining the economics and elasticity of the consumer cloud model with proper performance, application automation and security into a platform became a breakout success with enterprise customers and a natural fit for the EMC Federation.
The Internet of Things is not only adding billions of sensors and billions of terabytes to the Internet. It is also forcing a fundamental change in the way we envision Information Technology. For the first time, more data is being created by devices at the edge of the Internet rather than from centralized systems. What does this mean for today's IT professional? In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists addressed this very serious issue of profound change in the industry.
Discussions about cloud computing are evolving into discussions about enterprise IT in general. As enterprises increasingly migrate toward their own unique clouds, new issues such as the use of containers and microservices emerge to keep things interesting. In this Power Panel at 16th Cloud Expo, moderated by Conference Chair Roger Strukhoff, panelists addressed the state of cloud computing today, and what enterprise IT professionals need to know about how the latest topics and trends affect their organization.
It is one thing to build single industrial IoT applications, but what will it take to build the Smart Cities and truly society-changing applications of the future? The technology won’t be the problem, it will be the number of parties that need to work together and be aligned in their motivation to succeed. In his session at @ThingsExpo, Jason Mondanaro, Director, Product Management at Metanga, discussed how you can plan to cooperate, partner, and form lasting all-star teams to change the world and it starts with business models and monetization strategies.
Converging digital disruptions is creating a major sea change - Cisco calls this the Internet of Everything (IoE). IoE is the network connection of People, Process, Data and Things, fueled by Cloud, Mobile, Social, Analytics and Security, and it represents a $19Trillion value-at-stake over the next 10 years. In her keynote at @ThingsExpo, Manjula Talreja, VP of Cisco Consulting Services, discussed IoE and the enormous opportunities it provides to public and private firms alike. She will share what businesses must do to thrive in the IoE economy, citing examples from several industry sectors.
There will be 150 billion connected devices by 2020. New digital businesses have already disrupted value chains across every industry. APIs are at the center of the digital business. You need to understand what assets you have that can be exposed digitally, what their digital value chain is, and how to create an effective business model around that value chain to compete in this economy. No enterprise can be complacent and not engage in the digital economy. Learn how to be the disruptor and not the disruptee.
Akana has released Envision, an enhanced API analytics platform that helps enterprises mine critical insights across their digital eco-systems, understand their customers and partners and offer value-added personalized services. “In today’s digital economy, data-driven insights are proving to be a key differentiator for businesses. Understanding the data that is being tunneled through their APIs and how it can be used to optimize their business and operations is of paramount importance,” said Alistair Farquharson, CTO of Akana.
Business as usual for IT is evolving into a "Make or Buy" decision on a service-by-service conversation with input from the LOBs. How does your organization move forward with cloud? In his general session at 16th Cloud Expo, Paul Maravei, Regional Sales Manager, Hybrid Cloud and Managed Services at Cisco, discusses how Cisco and its partners offer a market-leading portfolio and ecosystem of cloud infrastructure and application services that allow you to uniquely and securely combine cloud business applications and services across multiple cloud delivery models.
The enterprise market will drive IoT device adoption over the next five years. In his session at @ThingsExpo, John Greenough, an analyst at BI Intelligence, division of Business Insider, analyzed how companies will adopt IoT products and the associated cost of adopting those products. John Greenough is the lead analyst covering the Internet of Things for BI Intelligence- Business Insider’s paid research service. Numerous IoT companies have cited his analysis of the IoT. Prior to joining BI Intelligence, he worked analyzing bank technology for Corporate Insight and The Clearing House Payment...
"Optimal Design is a technology integration and product development firm that specializes in connecting devices to the cloud," stated Joe Wascow, Co-Founder & CMO of Optimal Design, in this SYS-CON.tv interview at @ThingsExpo, held June 9-11, 2015, at the Javits Center in New York City.
SYS-CON Events announced today that CommVault has been named “Bronze Sponsor” of SYS-CON's 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. A singular vision – a belief in a better way to address current and future data management needs – guides CommVault in the development of Singular Information Management® solutions for high-performance data protection, universal availability and simplified management of data on complex storage networks. CommVault's exclusive single-platform architecture gives companies unp...
Electric Cloud and Arynga have announced a product integration partnership that will bring Continuous Delivery solutions to the automotive Internet-of-Things (IoT) market. The joint solution will help automotive manufacturers, OEMs and system integrators adopt DevOps automation and Continuous Delivery practices that reduce software build and release cycle times within the complex and specific parameters of embedded and IoT software systems.
"ciqada is a combined platform of hardware modules and server products that lets people take their existing devices or new devices and lets them be accessible over the Internet for their users," noted Geoff Engelstein of ciqada, a division of Mars International, in this SYS-CON.tv interview at @ThingsExpo, held June 9-11, 2015, at the Javits Center in New York City.
Internet of Things is moving from being a hype to a reality. Experts estimate that internet connected cars will grow to 152 million, while over 100 million internet connected wireless light bulbs and lamps will be operational by 2020. These and many other intriguing statistics highlight the importance of Internet powered devices and how market penetration is going to multiply many times over in the next few years.