If you already have an identifier (aka name) for the domain of a particular DO, then use that with `

If you already have an identifier (aka name) for the domain of a particular DO, then use that with .idFromName to get a DO id. The first time you do that in a given co-lo, it has to do a global lookup to confirm that it hasn't already been created somewhere else so there is a slight cost up front and maybe as you expand to more regions. After that, it's cached and has similar performance to .idFromString. idFromString has the location baked into the id itself so it doesn't have to wait to hear back from other regions when you first use it. My advice is to not worry about the miniscule and one-time performance hit from using idFromName. From what I hear that's actually more common than idFromString.
Was this page helpful?