Command deduplication persistence

If I run the sandbox with persistence turned on, will it persist its command id deduplication cache, or is it only kept in memory? If it’s persisted, I suppose it will “recover” the deduplication state upon restart?

Spot on, deduplication data is persisted on the sandbox, as well as any other DAML Ledger, to guarantee that command deduplication will continue working across restarts.