I finished Michael Nygard’s “Release It!”. Having discussed some of the anti-patterns and best practices for stability earlier, I am going to discuss capacity anti-patterns (some of them anyway – buy the book!):
- Resource Pool Contention. When the ratio of threads and resources in a pool are out of balance, the more time the threads waste in contention for the resource. On the flip side, if you have an app server farm with large database connection pools, the number of open sessions on the database server may simply overwhelm it.
- AJAX Overkill. AJAX can improve your user experience, but it does have a cost associated with it. The requests that will be hitting your server will be more frequent. Some of the automated polling that is done can overwhelm your server in high usage situations (effectively limiting capacity). The proper balance needs to be found.
- Overstaying Sessions. The java default is 30 minutes, which is often way too long (the book shows normal times for things like retail sites vs. travel sites). These unused sessions take up memory and other app server resources, limiting your capacity. Thus, you want to get rid of old sessions as soon as possible without visibly impacting your users. Your sessions should be small, only hold non-transient data, use keys instead of values where possible, and leverage soft references where supported by the language. In the end, that means more potential sessions and a capacity constraint elsewhere.
- Excessive White Space. These seem innocuous as browsers ignore extra white space in HTML, right? You are using more CPU cycles, more bandwidth, and more RAM to serve those pages up – put them on a diet.
- Data Eutropification. Your site may be zippy at first, but if you don’t have a strategy for expunging old data, you site will get slower and slower. It is certainly a bad practice to be doing data mining against the production database. Lack of partitioning as well as lack of indexes for ORM relationships can also have a big impact.
In the next post, I will follow up on the capacity best practices.