# (Read) Policy Replica \`CLOSEST\` and/or \`LOCAL\` (AER-5957)

**URL:** <https://discuss.aerospike.com/t/read-policy-replica-closest-and-or-local-aer-5957/1517>\
**Category:** Delivered Requests\
**Created:** [July 22, 2015, 4:47am UTC](https://discuss.aerospike.com/t/read-policy-replica-closest-and-or-local-aer-5957/1517 "2015-07-22T04:47:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![truongsinh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/truongsinh/32/291_2.png) [@truongsinh](https://discuss.aerospike.com/u/truongsinh)\
**Post date:** [July 22, 2015, 4:47am UTC](https://discuss.aerospike.com/t/read-policy-replica-closest-and-or-local-aer-5957/1517/1 "2015-07-22T04:47:03Z")

</div>

Currently, aerospike has 2 policy values for (read) replica: `master` and `any`, the latter of which means “a random choice of which replica to read”. I would like to suggest other policy values, `closest`, which means “read from the replica which has lowest latency”, and/or `local`, “read from unix socket/loopback interface if applicable, otherwise from `closest` or `any`”.

My use case: we are planning to use aerospike for session storage. We have 4 web instances running behind a load balancer in share-nothing manner. On each of these 4 instances, we will install an aerospike agent with `replication-factor=4`, ie 1 node will be master, and the rest in the cluster will have replicated data. To speed up read, it is preferred that the web app in each instance read from local aerospike, instead of randomly from the any of the instance of the cluster.

---

<div class="post-metadata">

**Author:** ![bbulkow](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@bbulkow](https://discuss.aerospike.com/u/bbulkow)\
**Post date:** [July 22, 2015, 6:38am UTC](https://discuss.aerospike.com/t/read-policy-replica-closest-and-or-local-aer-5957/1517/2 "2015-07-22T06:38:06Z")

</div>

I agree fully, this is a straightforward imporvement in any given client, and it is in our backlog — but it has been for a few months. If you have any ability to add this feature to our client before we get to the request ourselves, please submit a pull request, we’d really appreicate it.

---

<div class="post-metadata">

**Author:** ![kporter](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/kporter/32/515_2.png) [@kporter](https://discuss.aerospike.com/u/kporter)\
**Post date:** [January 11, 2019, 1:30am UTC](https://discuss.aerospike.com/t/read-policy-replica-closest-and-or-local-aer-5957/1517/3 "2019-01-11T01:30:53Z")

</div>

Many clients recently added support for reading from a particular ‘rack’.

The Java client, for example, supports this feature as of [4.2.3](https://www.aerospike.com/download/client/java/notes.html#4.2.3).

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/system/32/2274_2.png) [@system](https://discuss.aerospike.com/u/system)\
**Post date:** [January 17, 2019, 1:30am UTC](https://discuss.aerospike.com/t/read-policy-replica-closest-and-or-local-aer-5957/1517/4 "2019-01-17T01:30:56Z")

</div>

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.
