In my last blog I discussed some of the capacity anti-patterns of Michael Nyguard’s excellent but tragically misnamed book “Release It!” I finished reading the patterns and best practices portion, some of which are discussed below:
- Pool Connections. If bad connections are not removed from the pool, they will be given to proportionally more threads since they finish more quickly. You also need to consider your strategy for checking out resources from a pool. If you go per-page, you will have better protection against deadlock in multi-pool scenarios, but you will need a larger pool as these connections will be held longer. You also need to monitor calls to your connection pools to see how long threads are waiting.
- Use Caching Carefully. You need to be able to set the maximum memory usage for your cache. You should also be monitoring your hit rates to make sure the cache is buying you something. Don’t cache things which are cheap to regenerate, and use soft references where possible for when memory gets tight.
- Precompute Content. There is no need to recompute content that never changes or changes infrequently, yet this happens all the time. This is a great area to explore for increasing capacity.
An excellent resource in Rails is the “RailsLab: Scaling Rails” podcast I downloaded on iTunes. I have watched it before, but after reading this book, I will likely watch it again and start playing with what they suggest.
In the next blog, I will summarize the remainder of the book. However, I will likely hold off on publishing that until after the holidays.