timing-based affinity sorting for primary replicas

Change-Id: I837fa21c3a566b10cce33eb75788665e1d01cd8a