Vincent Partington: Top 10 Java EE performance problems

Home

News: Vincent Partington: Top 10 Java EE performance problems

  1. For the last two and a half months, Vincent Partington has been blogging about the top ten Enterprise Java Application Performance Problems. The list:Now he wraps up the countdown with some conclusions about Enterprise Java performance in general:
    • First of all, Java developers should consider performance an importance quality requirement of their application to which they should pay attention from the start to the end of the project.
    • Secondly, Java developers need to work with the people that can help them improve the performance of their application like application server and database administrators.
  2. This is a good list; however, some of these are generic enough to be performance issues for any application in any language. From my experience, I also find that #1 is the biggest performance issue (but again, regardless of platform/application).
  3. Dollar for Dollar I have found #1 and #7 to be the biggest two. Developers that have no interest in understanding relational data models have no business creating them and all too often it is the case that they do create them. As for #7 that would be my #1 the overuse of XML is horrendous. It is an absolute performance dog and unnecessary in probably 90% of the situations it is applied to. I find the entire concept of SOAP to be a moronic at best. We do not need human readable data languages for IPC or RPC we compact network optimized messaging that can reduce latency and memory overhead.
  4. This is a good list; however, some of these are generic enough to be performance issues for any application in any language. From my experience, I also find that #1 is the biggest performance issue (but again, regardless of platform/application).
    I have to agree here. The list is way too generic to be tied to Java or even Java EE. Nevertheless #1 remains the top performance issue in the average (Java) application. #1 quote:
    Use the database for what’s it good at: referential integrity checking, validation, manipulation, selection and sorting of large data sets. Don’t do this stuff in your Java code. For example, don’t write two queries and then merge the results in Java: use a join. Seems obvious, but merging in Java still happens a lot. Think EJB n+1 problem!
    While I won't say its a Java only problem I believe there is a large percentage of Java developers who don't know what a database is good at. Maybe it is just my impression but Joe average Java developer is capable of writing simple select, insert, update and delete statements, but never heard about different join types, unions or even inner selects. More importantly there are many so-called Java architects who completly ignore the importance of the database. In the end n+1 selects and other types of in-memory joins are the norm, not the exception. (At least they comply to a number of pattern and best practices ;) Looking at the list again I see just one thing that is (remotely) specific to Java (and Java EE): the presence of arrogance and ignorance. Just show me another group of developers and architects that call for distributed caches to fix their n+1 issues...
  5. Use the database for what’s it good at: referential integrity checking, validation, manipulation, selection and sorting of large data sets.
    Of course this depends on what you call a large dataset (relative to the amount of memory in your application servers) and how expensive it is to get the data in the first place. Generally speaking it's much easier to add extra application servers than adding extra DB servers (this is especially true when using systems like PostgreSQL or MySQL). Therefor, many typical Java EE setups have multiple AS boxes served by one (large) central DB. In those situations I would not always blindly follow the rule of not sorting in Java. Namely, every time I do a sort in Java on one of my application servers I'm offloading the DB. If the data is expensive to recreate (e.g. lots of aggregations over many rows) it's even faster to just do the simple sort in Java on the data that's already available on my AS. So, both total system utilization as well as performance can potentially be better. Not always, of course not, but the potential should be explored.
    Don’t do this stuff in your Java code. For example, don’t write two queries and then merge the results in Java: use a join.
    Even this is not always true. In some situations you may need a resultset where the type of one of the columns is another resulset. With some DBMS specific syntax you may be able to join and aggregate values to SQL arrays, but I don't think it's easy to aggregate a group of values to a resultset. If you need this sort of thing, it's often easier to just fire off two queries, create your own resultsets for the first query and insert those in each row of the second query. (but if you know of a neat way of how to do this in standard SQL, I'm open to suggestions ;) )
  6. #8 is Java/EE specific, but quite dated or not?
  7. This is a good list; however, some of these are generic enough to be performance issues for any application in any language. From my experience, I also find that #1 is the biggest performance issue (but again, regardless of platform/application).
    I guess a lot of this issues aren't Java EE specific. The reason I choose that scope is because my experiences are based on Java EE projects and I figured it would be presumptuous to assume the same problems occurred in .NET or PHP or whatever. Desktop apps probably have very different issues, but I'd be happy to call my list the list of enterprise/web performance problems. ;-) Regards, Vincent.
  8. Good article[ Go to top ]

    Hi Joseph, This was indeed good article and a learning experience. Here in our project we are not doing logging properly and mostly change code across project to implement in correct manner.Actually we are missing check of isDebugEnabled() :-) Regarding database we are using hibernate so can you please suggest if any when using hibernate. Thanks Prashant
  9. The list goes on[ Go to top ]

    I'd like to add two points: 11) Use a proper category entry in log4j.xml, otherwise isDebugEnabled() will be useless (beware with Hibernate and JBossCache/JGroups for example). Only using the threshold in the appenders won't do. 12) Create indexes on the foreign key columns in your Oracle DB, otherwise the database will lock. At least for Oracle 9i and older. This is not an easy task. I wrote a small app that extracts the needed statements from the .hbm.xml (Hibernate) files.
  10. Re: The list goes on[ Go to top ]

    Tobias,
    I'd like to add two points:
    ...
    12) Create indexes on the foreign key columns in your Oracle DB, otherwise the database will lock. At least for Oracle 9i and older. This is not an easy task. I wrote a small app that extracts the needed statements from the .hbm.xml (Hibernate) files.
    that's why you usually hire an database expert and don't ask application developers to look for those issues;). For instance "the problem" you talk about is a well-known, well-documented topic. Look at chapter "Data Integrity" in "Oracle Server Application Developer Guide". You will find everything you need to know at least since 7i. So I would say: 12) Always have a DBA in your project team. 13) Never ever design your ER schema top down.
  11. 13) Never ever design your ER schema top down.
    What about those things like EJB3.JPA, JDO2 and Hibernate? Aren't they supposed to hide/abstract persistence DB from application domain model? I think it has to be a good balance between DB relational design and application object domain design. Going far in either way may cause problems.
  12. Here is another list in case people are interested http://jonathanhui.com/top-j2ee-application-performance-problems