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
    When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
    SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From planning to development to management to security, CA creates software that fuels transformation for companies in the applic...
    SYS-CON Events announced today that CAST Software will exhibit at 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. CAST was founded more than 25 years ago to make the invisible visible. Built around the idea that even the best analytics on the market still leave blind spots for technical teams looking to deliver better software and prevent outages, CAST provides the software intelligence that matter ...
    SYS-CON Events announced today that Pulzze Systems will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Pulzze Systems Inc, provides the software product "The Interactor" that uniquely simplifies building IoT, Web and Smart Enterprise Solutions. It is a Silicon Valley startup funded by US government agencies, NSF and DHS to bring innovative solutions to market.
    In his session at @ThingsExpo, Dr. Robert Cohen, an economist and senior fellow at the Economic Strategy Institute, presented the findings of a series of six detailed case studies of how large corporations are implementing IoT. The session explored how IoT has improved their economic performance, had major impacts on business models and resulted in impressive ROIs. The companies covered span manufacturing and services firms. He also explored servicification, how manufacturing firms shift from se...
    SYS-CON Events announced today that Elastifile will exhibit at 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. Elastifile Cloud File System (ECFS) is software-defined data infrastructure designed for seamless and efficient management of dynamic workloads across heterogeneous environments. Elastifile provides the architecture needed to optimize your hybrid cloud environment, by facilitating efficient...
    SYS-CON Events announced today that Golden Gate University will exhibit at 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. Since 1901, non-profit Golden Gate University (GGU) has been helping adults achieve their professional goals by providing high quality, practice-based undergraduate and graduate educational programs in law, taxation, business and related professions. Many of its courses are taug...
    Recently, WebRTC has a lot of eyes from market. The use cases of WebRTC are expanding - video chat, online education, online health care etc. Not only for human-to-human communication, but also IoT use cases such as machine to human use cases can be seen recently. One of the typical use-case is remote camera monitoring. With WebRTC, people can have interoperability and flexibility for deploying monitoring service. However, the benefit of WebRTC for IoT is not only its convenience and interopera...
    When shopping for a new data processing platform for IoT solutions, many development teams want to be able to test-drive options before making a choice. Yet when evaluating an IoT solution, it’s simply not feasible to do so at scale with physical devices. Building a sensor simulator is the next best choice; however, generating a realistic simulation at very high TPS with ease of configurability is a formidable challenge. When dealing with multiple application or transport protocols, you would be...
    WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
    An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics ...
    SYS-CON Events announced today that Secure Channels, a cybersecurity firm, will exhibit at 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. Secure Channels, Inc. offers several products and solutions to its many clients, helping them protect critical data from being compromised and access to computer networks from the unauthorized. The company develops comprehensive data encryption security strategie...
    Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, shared examples from a wide range of industries – including en...
    Detecting internal user threats in the Big Data eco-system is challenging and cumbersome. Many organizations monitor internal usage of the Big Data eco-system using a set of alerts. This is not a scalable process given the increase in the number of alerts with the accelerating growth in data volume and user base. Organizations are increasingly leveraging machine learning to monitor only those data elements that are sensitive and critical, autonomously establish monitoring policies, and to detect...
    "We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
    To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. Jack Norris reviews best practices to show how companies develop, deploy, and dynamically update these applications and how this data-first...
    Intelligent Automation is now one of the key business imperatives for CIOs and CISOs impacting all areas of business today. In his session at 21st Cloud Expo, Brian Boeggeman, VP Alliances & Partnerships at Ayehu, will talk about how business value is created and delivered through intelligent automation to today’s enterprises. The open ecosystem platform approach toward Intelligent Automation that Ayehu delivers to the market is core to enabling the creation of the self-driving enterprise.
    The question before companies today is not whether to become intelligent, it’s a question of how and how fast. The key is to adopt and deploy an intelligent application strategy while simultaneously preparing to scale that intelligence. In her session at 21st Cloud Expo, Sangeeta Chakraborty, Chief Customer Officer at Ayasdi, will provide a tactical framework to become a truly intelligent enterprise, including how to identify the right applications for AI, how to build a Center of Excellence to ...
    SYS-CON Events announced today that Massive Networks will exhibit at 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. Massive Networks mission is simple. To help your business operate seamlessly with fast, reliable, and secure internet and network solutions. Improve your customer's experience with outstanding connections to your cloud.
    SYS-CON Events announced today that Datera, that offers a radically new data management architecture, has been named "Exhibitor" 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. Datera is transforming the traditional datacenter model through modern cloud simplicity. The technology industry is at another major inflection point. The rise of mobile, the Internet of Things, data storage and Big...