<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:07 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-804] Support Monotonic Read Consistency when reading from secondaries</title>
                <link>https://jira.mongodb.org/browse/JAVA-804</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;It would be great if the Java driver would support Monotonic Read Consistency when reading from secondaries.&lt;/p&gt;

&lt;p&gt;The use case are read-heavy applications that don&apos;t need strong consistency but require updates to be visible in the same order as they happened on the primary. When using a secondary read preference, the driver currently distributes read load to different secondaries. This means the order of updates is not preserved and in the application it may look as if time is going backwards - sometimes.&lt;/p&gt;

&lt;p&gt;One solution to achieve monotonic reads is to use the default primary read preference and distribute load via sharding only. However for read-heavy applications which do not need strong consistency (as ensured by read preference primary) it makes sense to scale read-load over secondaries to avoid the additional cost and complexity that comes with sharding. Even with sharding in place, the number of required shards can be lower if read load is not only handled by the primaries.&lt;/p&gt;

&lt;p&gt;Note that the Java driver already supports monotonic reads per thread with requestStart()/requestEnd() methods. However there&apos;s no possibility to achieve this for the entire application. Using only one thread per application not an option as it would kill performance.&lt;/p&gt;</description>
                <environment></environment>
        <key id="71598">JAVA-804</key>
            <summary>Support Monotonic Read Consistency when reading from secondaries</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="ahubold">Andreas Hubold</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Apr 2013 07:35:12 +0000</created>
                <updated>Fri, 23 Jun 2017 15:34:11 +0000</updated>
                            <resolved>Fri, 23 Jun 2017 15:34:11 +0000</resolved>
                                    <version>2.11.1</version>
                                                    <component>Cluster Management</component>
                                        <votes>10</votes>
                                    <watches>6</watches>
                                                                                                                <comments>
                            <comment id="1605274" author="jeff.yemin" created="Fri, 23 Jun 2017 15:34:11 +0000"  >&lt;p&gt;MongoDB 3.6 will support causally consistent reads against secondaries.  Given that, I don&apos;t see a reason to implement a monotonic read preference mode.&lt;/p&gt;</comment>
                            <comment id="311783" author="ahubold" created="Fri, 12 Apr 2013 07:44:51 +0000"  >&lt;p&gt;This topic was discussed at &lt;a href=&quot;https://groups.google.com/d/msg/mongodb-user/0LG7e9OAEPs/31Xnlwo2-ewJ&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/d/msg/mongodb-user/0LG7e9OAEPs/31Xnlwo2-ewJ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One implementation idea would be to read from only one node at a time and when doing a failover to a different node, wait until that node has at least seen the last read value. Reading from a single node ensures monotonic read consistency because Mongo replication preserves the update order.&lt;/p&gt;

&lt;p&gt;It looks like mgo, the MongoDB driver for Go, supports Monotonic reads: &lt;a href=&quot;http://godoc.org/labix.org/v2/mgo&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://godoc.org/labix.org/v2/mgo&lt;/a&gt;.&lt;br/&gt;
(Note that it even supports &quot;Read your own writes&quot; if it was configured for monotonic reads. Not sure if this is always needed in combination).&lt;/p&gt;

&lt;p&gt;BTW, consistency models are explained nicely here: &lt;a href=&quot;http://blog.mongodb.org/post/523516007/on-distributed-consistency-part-6-consistency-chart&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://blog.mongodb.org/post/523516007/on-distributed-consistency-part-6-consistency-chart&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrgah3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>8602</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>