2009/6/11 Rafael Schloming <rafa...@redhat.com>: > Martin Ritchie wrote: >> >> Hi, >> >> Just wanted to generate some discussion on peoples thoughts around >> changing the Java prefetch from its current 5000 value to 1. >> >> Having a default of 1 will work for all users and prevent users from >> hurting themselves when they use priority queues or TTL and expect >> things to just work. >> >> If users know what they're messaging profile is and so know what they >> are doing then they can set the maxprefetch to a higher value. >> >> Thoughts/ Comments? > > I'm generally in favor of changing the default to something safer than 5000, > assuming that it is prominently documented how to adjust it for performance. > > One thought though -- shouldn't the default for consumers with no listeners > actually be zero so that you don't have a messaging sitting around waiting > for a receive() call that may never come?
Perhaps but a zero value in AMQP 0-8/0-9 means don't use message count for prefetch. The java client 0-8/0-9 code path (and potentially the 0-10) starts the session suspended to protected against things like mule creating a session with a consumer to test a destination is valid but never actually consumes. There is still a danger of a user creating another consumer on one session and only ever using one of them. However, I don't think it is possible in 0-8/0-9 to solve this as the prefetch is at a session level and you have to create the AMQP consumer when the jms createConsumer call is made. The prefetch is per session not per consumer so the second consumer will get prefetched messages. I do recall the discussion about a non/slow consumer starving other consumers on the session but I don't recall if we solved that. If we don't have a test for this then setting the prefetch to 1 would certainly highlight this issue much sooner. Of course we could opt not to solve this for 0-8/0-9 and say that you can only have one consumer per session or risk starvation. This sort of vendor restriction wouldn't be unheard of as IBM-MQ only allows one session per connection. Martin > --Rafael > > --------------------------------------------------------------------- > Apache Qpid - AMQP Messaging Implementation > Project: http://qpid.apache.org > Use/Interact: mailto:dev-subscr...@qpid.apache.org > > -- Martin Ritchie --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:dev-subscr...@qpid.apache.org