Zookeeper easy
What is the primary technical function of a ZooKeeper 'Watch'?
- A To proactively encrypt the ZNode data before it is persisted to the local storage disk.
- B A one-time trigger mechanism that notifies a client asynchronously when a specific ZNode changes.
- C To perform periodic polling of the leader node to ensure the local cache remains in sync.
- D A background process that automatically reorganizes the hierarchical namespace for better I/O.
Answer: B. A one-time trigger mechanism that notifies a client asynchronously when a specific ZNode changes.
Instead of polling the server every second ('Has data changed?'), the client sets a Watch. When the data changes, ZooKeeper sends an event to the client. Note: Watches are one-time; you must re-set them after they fire.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- A system administrator increases `jute.maxbuffer` to 5MB on every ZooKeeper server to store large configuration objects. However, write operations larger than 1MB still fail. What is the most likely cause?
- By default, `forceSync` is enabled. If you disable it, what trade-off are you making?
- If the specific ZooKeeper node a client is connected to crashes, what should the client do?
- Which cluster configuration has *worse* availability: A 3-node cluster or a 4-node cluster? (Assuming simple majority quorum)
- According to the CAP Theorem, how is ZooKeeper classified?
- You need to implement a Distributed Queue where multiple producers push tasks. How does the 'Sequential' Znode flag provide the necessary ordering primitive?