Saturday, September 22, 2007
JMS - Message Prefetch Size
Many JMS providers implement message prefetch size (see Active MQ's what is the prefetch size?). A receive() call on message consumer reads number of messages as set by prefetch size. For the most part this is a good thing since message delivery is batched such that consumer always has messages to process. However this can also hurt performance if there are multiple receivers i.e. multiple message consumers are running on same hardware (vertical scaling) or on different hardware(s). We ran into this problem with Glassfish JMS provider. We had multiple legacy integration gateways running in a combination of vertical/horizontal scaled deployment but we did not see an increase in message processing throughput by legacy gateways. As matter of fact out of six gateways 4 of them were idle for the most part, doing nothing. The reason these additional gateways were idle as it turns out was due to Glassfish JMS's default message prefetch size of 1000 (Open MQ, Glassfish's JMS implementation, calls this imqConsumerFlowLimit). In our tests we had under 2000 messages, so the first two consumer to issue read would 1000 each. Thus other 4 gateways had nothing to read off the queue and hence nothing to do. We brought it down to 1 and all gateways started to process messages and overall system throughput increased significantly. In our case gateways are I/O bound calling into legacy application and waiting for results. So for our application prefetch size of 1 was optimal. In other applications, a different prefetch size is going to be optimal. The lesson, as always with performance optimization is: profile your application, find hot spots or performance bottlenecks of the application and then optimize. There is no one size fits all with regards to performance.
Wednesday, September 19, 2007
Planning Fallacies
Interesting articles on challenges in project/activity planning.
Planning Fallacy
Kahneman's Planning Anecdote
Planning Fallacy
Kahneman's Planning Anecdote
Tuesday, September 11, 2007
An Empirical Comparison of Seven Programming Languages
An Empirical Comparison of Seven Programming Languages
Interesting study on effectiveness of various programming languages, also some insight into how a programming language influences programmers' thinking and approach to a problem.
Here is a ruby solution. More information on this puzzle.
Seemingly a simple problem, but solution is far from trivial, more so if performance and memory efficiency is taken into consideration.
Interesting study on effectiveness of various programming languages, also some insight into how a programming language influences programmers' thinking and approach to a problem.
Here is a ruby solution. More information on this puzzle.
Seemingly a simple problem, but solution is far from trivial, more so if performance and memory efficiency is taken into consideration.