This is not something you can use the consumer API to simply do easily (consumers don't have locality notion). I can imagine using Kafka's low-level API calls to get a list of partitions and the lead replica, figuring out which are local and using those - but that sounds painful.
Are you 100% sure the performance issue is due to network latency? If not, you may want to start optimizing somewhere more productive :) Kafka brokers and clients both have Metrics that may help you track where the performance issues are coming from. Gwen On Wed, Jul 15, 2015 at 9:24 AM, Robert Metzger <rmetz...@apache.org> wrote: > Hi Shef, > > did you resolve this issue? > I'm facing some performance issues and I was wondering whether reading > locally would resolve them. > > On Mon, Jun 22, 2015 at 11:43 PM, Shef <she...@yahoo.com> wrote: > >> Noob question here. I want to have a single consumer for each partition >> that consumes only the messages that have been written locally. In other >> words, I want the consumer to access the local disk and not pull anything >> across the network. Possible? >> >> How can I discover which partitions are local? >> >> >>