Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Improving Performance, Avoiding Hung Threads, and Keeping It Simple

Improving Performance, Avoiding Hung Threads, and Keeping It Simple

Q. What are some quick steps I can take to improve CPU utilization?
A.
If your application is experiencing serious performance problems, I recommend that you perform a thorough analysis to determine the root cause. But if you're looking for some quick ways to optimize application performance, here are a few tips that may help.

  • Distribute your JSPs. Much of the CPU burn for many applications is consumed by parsing back-end data up into data structures for handoff to the application's view (JSPs typically). If the CPU is burned in that part of the application, then chances are very good that it also gets burned while pulling apart these data structures when building the JSP itself. Try distributing your JSPs into a container separate from the business logic. As a result, more CPU will be available to help out with back-end data requests. Better yet, you'll understand whether the "front" or the "back" of your architecture burns more resources, so you can tune and/or add resources accordingly.

  • Review the semantics of your application's back-end connection usage (JDBC, JMS, etc.). Make sure all calls to distributed remote systems are wrapped with sensible timeouts (i.e., if a call hasn't come back in 15 or 30 seconds when it normally takes less than 5, then send a sensible error message back to the user). This helps you avoid the risk of hanging the entire application server due to a single failed resource.

  • Reduce the amount of data offered in search results. If your application returns search results, make sure it hands back less data at a time - not just to the user but to the WebLogic Server instance itself. If your application is fast, they won't mind clicking again. Large amounts of data can create a "pig in the python" problem throughout your entire application architecture.
  • Reduce unnecessary logging. As I mentioned in an earlier column (WLDJ, Vol. 2, issue 7), while logging is a great analytical tool, too much logging can cause excess CPU utilization. Consider putting a dynamic switch into your application that will allow you to redirect the logging to /dev/null whenever it is unnecessary. Additionally, when logging, you can use the features available in JDK 1.4 to select the appropriate level of granularity.

  • Measure, measure, measure. This final point is very important. There is no substitute for gaining a complete understanding of where your application is using resources and why. If you understand the answer to those questions, you'll know what it takes to improve your performance.

    Q: What are some good defensive programming techniques I can mandate for my developers to avoid a "hung thread" or "hung server" in production?
    A:
    In another column (WLDJ, Vol. 2, issue 6), I discussed finding the causes of stalled threads. Here are some techniques that can help you avoid them altogether. In most cases, a "hung thread" is one that has blocked on contacting a back-end system for data needed to dispatch its request. The most common of these is a database, in which case it is probably being contacted via JDBC. If your application is passing messages, it may be a JMS implementation. If it is a proprietary or legacy system, it might talk only a specific protocol over TCP/IP. The list goes on.

    The key is to make sure that the application knows what to do if the resource it needs is just not available. Most of the time, this isn't a problem because the code for timing out sockets to the remote DB server is all in the JDBC driver.

    When you have to handle timing out a connection yourself, the situation is significantly more complicated. David Reilly wrote a very informative article on handling network timeouts entitled "Simple Handling of Network Timeouts," which can still be found on the Web.

    There is no replacement for understanding how your transactions will behave at the code level when remote resources become unavailable. There are, however, a number of parameters in the various layers of software supporting your application that may be tuned to obtain better failure patterns right away. WebLogic Server itself includes a number of parameters for tuning how the EJB container transactions are timed out (http://edocs.bea.com/wls/docs70/ejb/ reference.html#1072610).

    The moral of the story is: if you're struggling with hung threads and suspends in your application, or you want to avoid struggling with them, spend time thinking about how each and every one of the connector components in your application will behave when the back-end resource on which they rely disappears.

    Q. Of the application architectures you've seen, which have been the most successful?
    A:
    When it comes to matters like this, my philosophy has always been to keep it simple. In my experience, the projects that usually end up on time and under budget are those that have been completed in the most straightforward way possible.

    Does this mean that you can ignore the principles of object-oriented design? No, but there may be times when you have too much of a good thing. Most architects of object-oriented applications will rightly object to two different teams creating their own versions of a thread pool. Doing this will result in a larger, less maintainable code base; bugs in one version will not necessarily get fixed in the other. But what about the logging strategy adopted for an application? One application may need logging for debugging and performance analysis. Another may need it to audit every transaction, perhaps for security purposes. Insisting on a unified logging framework for an entire enterprise might result in a logging approach that doesn't necessarily make sense for each application. For many applications, having a separate servlet for every important application use case, a small library of business logic that is not necessarily EJBs, and a JSP for each customer view of the Web application just might be exactly what you need. The bottom line is, keep it simple but be sensible; don't break the rules unless you know them first.

  • More Stories By Lewis Cirne

    Lew Cirne is the founder of New Relic, the first provider of on-demand (SaaS) application management tools for cloud or datacenter applications. A seasoned entrepreneur, technologist, and enterprise software pioneer, he has been focused on application performance management for more than ten years. Cirne holds seven patents related to application performance technology. Most recently he was an Entrepreneur in Residence at Benchmark Capital. He founded and was first CEO of Wily Technology and earlier held senior engineering positions at Apple and Hummingbird Communications.

    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
    "MobiDev is a Ukraine-based software development company. We do mobile development, and we're specialists in that. But we do full stack software development for entrepreneurs, for emerging companies, and for enterprise ventures," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
    We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA
    SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
    Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists looked at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deliver...
    The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
    SYS-CON Events announced today that Enzu will exhibit at SYS-CON's 21st Int\ernational Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enzu’s mission is to be the leading provider of enterprise cloud solutions worldwide. Enzu enables online businesses to use its IT infrastructure to their competitive advantage. By offering a suite of proven hosting and management services, Enzu wants companies to focus on the core of their ...
    In his session at @ThingsExpo, Eric Lachapelle, CEO of the Professional Evaluation and Certification Board (PECB), provided an overview of various initiatives to certify the security of connected devices and future trends in ensuring public trust of IoT. Eric Lachapelle is the Chief Executive Officer of the Professional Evaluation and Certification Board (PECB), an international certification body. His role is to help companies and individuals to achieve professional, accredited and worldwide re...
    With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
    With the introduction of IoT and Smart Living in every aspect of our lives, one question has become relevant: What are the security implications? To answer this, first we have to look and explore the security models of the technologies that IoT is founded upon. In his session at @ThingsExpo, Nevi Kaja, a Research Engineer at Ford Motor Company, discussed some of the security challenges of the IoT infrastructure and related how these aspects impact Smart Living. The material was delivered interac...
    IoT solutions exploit operational data generated by Internet-connected smart “things” for the purpose of gaining operational insight and producing “better outcomes” (for example, create new business models, eliminate unscheduled maintenance, etc.). The explosive proliferation of IoT solutions will result in an exponential growth in the volume of IoT data, precipitating significant Information Governance issues: who owns the IoT data, what are the rights/duties of IoT solutions adopters towards t...
    New competitors, disruptive technologies, and growing expectations are pushing every business to both adopt and deliver new digital services. This ‘Digital Transformation’ demands rapid delivery and continuous iteration of new competitive services via multiple channels, which in turn demands new service delivery techniques – including DevOps. In this power panel at @DevOpsSummit 20th Cloud Expo, moderated by DevOps Conference Co-Chair Andi Mann, panelists examined how DevOps helps to meet the de...
    When growing capacity and power in the data center, the architectural trade-offs between server scale-up vs. scale-out continue to be debated. Both approaches are valid: scale-out adds multiple, smaller servers running in a distributed computing model, while scale-up adds fewer, more powerful servers that are capable of running larger workloads. It’s worth noting that there are additional, unique advantages that scale-up architectures offer. One big advantage is large memory and compute capacity...
    No hype cycles or predictions of zillions of things here. IoT is big. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, Associate Partner at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He discussed the evaluation of communication standards and IoT messaging protocols, data analytics considerations, edge-to-cloud tec...
    "When we talk about cloud without compromise what we're talking about is that when people think about 'I need the flexibility of the cloud' - it's the ability to create applications and run them in a cloud environment that's far more flexible,” explained Matthew Finnie, CTO of Interoute, in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
    SYS-CON Events announced today that Silicon India has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Published in Silicon Valley, Silicon India magazine is the premiere platform for CIOs to discuss their innovative enterprise solutions and allows IT vendors to learn about new solutions that can help grow their business.
    The Internet giants are fully embracing AI. All the services they offer to their customers are aimed at drawing a map of the world with the data they get. The AIs from these companies are used to build disruptive approaches that cannot be used by established enterprises, which are threatened by these disruptions. However, most leaders underestimate the effect this will have on their businesses. In his session at 21st Cloud Expo, Rene Buest, Director Market Research & Technology Evangelism at Ara...
    Amazon started as an online bookseller 20 years ago. Since then, it has evolved into a technology juggernaut that has disrupted multiple markets and industries and touches many aspects of our lives. It is a relentless technology and business model innovator driving disruption throughout numerous ecosystems. Amazon’s AWS revenues alone are approaching $16B a year making it one of the largest IT companies in the world. With dominant offerings in Cloud, IoT, eCommerce, Big Data, AI, Digital Assista...
    The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
    SYS-CON Events announced today that TMC has been named “Media Sponsor” of SYS-CON's 21st International Cloud Expo and Big Data at Cloud Expo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Global buyers rely on TMC’s content-driven marketplaces to make purchase decisions and navigate markets. Learn how we can help you reach your marketing goals.