You are asking two related but different questions. One is how does load
balancing work and the other is how does broker discovery works. Jun
explained how load balancing works and how requests are routed to
partitons. In 0.7, there were 2 options for broker discovery - zookeeper
and hardware load balancer (VIP). The zookeeper based producer got notified
by zookeeper whenever a new broker came up or an existing broker went down.
In 0.8, we got rid of zookeeper from the producer and replaced it with a
metadata API. On startup and whenever a request fails, the producer
refreshes its view of the cluster by sending a metadata request to any of
the brokers. So if a broker goes down or a new broker comes up, the leader
for some partitions might change and the producer will know since its
requests to the older leaders will fail.
Hope that helps,
On Mon, Jan 14, 2013 at 9:52 PM, Jun Rao <[EMAIL PROTECTED]> wrote: