And the #1 killer of performance in a web application is…

OK, sure, if you write a query that takes 10 minutes, then your performance is going to be terrible.  But of all the systems I have seen, usually there is somebody around who can both detect a long running query and fix it.

What tends to kill systems is the number of round trips between the application server and the database. How bad can it be?  REALLY BAD!  The worst I have ever seen was 60,000 round trips to do a small batch routine in a UI.  Someone from the US military came up to me after a presentation and said that they had seen a single UI operation that required over 200,000 round trips to the server.

How can such a thing be? Two words: “getters” and “setters.” If your UI developer thinks that context switches between the UI code the database are costless and that the pipeline between the database and the application server has infinite bandwidth and speed, then doing a round trip for each attribute can seem like a pretty smart idea.

Of course, context switches are very expensive things. The bandwidth between the application server and the database is not infinite.  Therefore, lots of round trips ends up being the number 1 killer of system performance.

The most egregious example of this was a system being built for a very famous organization involved in loans.  They placed getters and setters on each attribute in the month-end batch routine.  As a result, it took about one minute to do the month end processing for each loan.  Given that about 14,000,000 loans needed to be processed, this meant that the month-end routine would take over 26 years to complete.

How can you fix this problem?  There are a few different alternatives:

  1. Use a thick database approach and move the logic next to the data in order to take advantage of the power of the DBMS.
  2. Be very careful to minimize the number of round trips and filter the rows on the database side.  Don’t retrieve 100,000 rows so that you can filter through them and find a single record. No UI operation should take more than a handful of round trips.
  3. Move all of the data into the middle tier or into memory.  This is really the same idea as option number 1, namely put the data and the code in one place and avoid the context switches.

Personally, I am a fan of option number 1.  I will post about thick database tomorrow.

Tagged with: , , , , ,
Posted in BLOG, Consulting, Development

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Disclaimer
The information presented on this blog is presented to provide general technical information. If, while attempting to apply any of the ideas, procedures, or suggestions herein, you experience any kind of programming or system problems or failure, it will be as a result of your own actions. Dulcian, Inc. and all authors of text found anywhere on this site, and all internally-linked Web sites, Mail Lists, Blogs and/or e-mail group discussion, disclaim responsibility for any user's actions and any damage that may occur based on information found on this website and associated Mail Lists, Blogs and/or e-mail group discussion. Any technical advice or directions found on or through this site is provided AS IS and its provided without warranty or any guarantee of its accuracy. You perform any modifications to programs or software AT YOUR OWN RISK.