How Frontend Service find the correct historyHost to route the RPC


I am reading a bit of source code of temporal server. I found that the history service actually checks if the host calculated by host = lookup(hash32(workflow_id+namesapce)mod shardCount) is current host. But how could the frontend service find the correct host in the first place? I am quite confused at this point.

Frontend uses history client to find the history host for the workflow id using consistent hashing as you have shown and then routs the start workflow execution request to the correct history host.
Hope this helps.

1 Like

oh, I missed the logic in the client package. Really appreciate it. Thank you :slight_smile: