<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:15:02 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>[CDRIVER-2376] Performance loss with small reads and writes</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-2376</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;Somewhere between commits a3c8a76 and 470fb4175c we lost a lot of performance in TestRunCommand, TestSmallDocInsertOne, and TestFindOneByID. The tests that read and write larger messages have such noisy results it&apos;s possible we missed a regression there too.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://evergreen.mongodb.com/task/mongo_c_driver_perf_c_driver_benchmark_mongo32_BenchMarkTests_76791d6e7dc01cd1b55d838eaf16fc4f2291d746_17_11_14_19_43_24&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://evergreen.mongodb.com/task/mongo_c_driver_perf_c_driver_benchmark_mongo32_BenchMarkTests_76791d6e7dc01cd1b55d838eaf16fc4f2291d746_17_11_14_19_43_24&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There&apos;s a large number of changes between the benchmark runs, so it&apos;s hard to say if it&apos;s changes to compression, or changes to the OP_QUERY path related to implementing OP_MSG, or if it&apos;s a mistake in &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2172&quot; title=&quot;Call &amp;quot;ping&amp;quot; on a socket that has been idle for socketCheckIntervalMS&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2172&quot;&gt;&lt;del&gt;CDRIVER-2172&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The C Driver&apos;s performance benchmark suite is in a separate repo:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver-performance&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver-performance&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Its Evergreen configuration is in the main repo, however:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/master/.evergreen/benchmark.yml&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/blob/master/.evergreen/benchmark.yml&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instructions for running the benchmark suite are in that mongo-c-driver-performance README.&lt;/p&gt;

&lt;p&gt;Some performance tests use JSON files. Download them with the download-test-data.py program in the mongo-c-driver-performance repo.&lt;/p&gt;

&lt;p&gt;Make sure you&apos;ve built and installed a release version of libbson and libmongoc for the correct version that you want to test. Build libbson something like:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;git checkout SOME_GIT_HASH&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;mkdir cmake-build-release&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;cd cmake-build-release&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;cmake -DCMAKE_BUILD_TYPE=RELEASE .. &amp;amp;&amp;amp; make &amp;amp;&amp;amp; sudo make install&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Same for libmongoc. Not all versions of libbson and libmongoc are compatible with each other (because of the history of this year&apos;s development), &lt;/p&gt;

&lt;p&gt;Now in the mongo-c-driver-performance repo, build the mongo-c-performance program. Start a MongoDB 3.2 standalone on localhost. Run the tests:&lt;/p&gt;

&lt;p&gt;./mongo-c-performance performance-testdata/ TestRunCommand&lt;/p&gt;

&lt;p&gt;You can specify multiple test names on the command line.&lt;/p&gt;</description>
                <environment></environment>
        <key id="459249">CDRIVER-2376</key>
            <summary>Performance loss with small reads and writes</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13201">Fixed</resolution>
                                        <assignee username="jesse@mongodb.com">A. Jesse Jiryu Davis</assignee>
                                    <reporter username="jesse@mongodb.com">A. Jesse Jiryu Davis</reporter>
                        <labels>
                    </labels>
                <created>Wed, 15 Nov 2017 18:39:25 +0000</created>
                <updated>Sat, 28 Oct 2023 11:30:19 +0000</updated>
                            <resolved>Wed, 20 Dec 2017 20:34:21 +0000</resolved>
                                    <version>1.9.0</version>
                                    <fixVersion>1.9.0</fixVersion>
                                    <component>libmongoc</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1757196" author="xgen-internal-githook" created="Wed, 20 Dec 2017 20:37:50 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;A. Jesse Jiryu Davis&apos;, &apos;email&apos;: &apos;jesse@mongodb.com&apos;, &apos;username&apos;: &apos;ajdavis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2376&quot; title=&quot;Performance loss with small reads and writes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2376&quot;&gt;&lt;del&gt;CDRIVER-2376&lt;/del&gt;&lt;/a&gt; fix performance loss&lt;/p&gt;

&lt;p&gt;Starting in commit #9f9934dcd, the driver had incorrectly called &quot;ping&quot;&lt;br/&gt;
before nearly every command when in single-threaded mode. This was due&lt;br/&gt;
to the mongoc_topology_scanner_node_t.last_update field not being&lt;br/&gt;
updated, so the driver thought each server&apos;s socket had been idle and&lt;br/&gt;
needed to be checked with &quot;ping&quot;, even when the socket had been used&lt;br/&gt;
recently.&lt;/p&gt;

&lt;p&gt;In this commit, update last_used after every command so we don&apos;t call&lt;br/&gt;
&quot;ping&quot; unnecessarily.&lt;br/&gt;
Branch: r1.9&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/80628aa2cbdc7c324cca456ff442bd2f54357666&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/80628aa2cbdc7c324cca456ff442bd2f54357666&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1757195" author="xgen-internal-githook" created="Wed, 20 Dec 2017 20:37:24 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;A. Jesse Jiryu Davis&apos;, &apos;email&apos;: &apos;jesse@mongodb.com&apos;, &apos;username&apos;: &apos;ajdavis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-2376&quot; title=&quot;Performance loss with small reads and writes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-2376&quot;&gt;&lt;del&gt;CDRIVER-2376&lt;/del&gt;&lt;/a&gt; fix performance loss&lt;/p&gt;

&lt;p&gt;Starting in commit #9f9934dcd, the driver had incorrectly called &quot;ping&quot;&lt;br/&gt;
before nearly every command when in single-threaded mode. This was due&lt;br/&gt;
to the mongoc_topology_scanner_node_t.last_update field not being&lt;br/&gt;
updated, so the driver thought each server&apos;s socket had been idle and&lt;br/&gt;
needed to be checked with &quot;ping&quot;, even when the socket had been used&lt;br/&gt;
recently.&lt;/p&gt;

&lt;p&gt;In this commit, update last_used after every command so we don&apos;t call&lt;br/&gt;
&quot;ping&quot; unnecessarily.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/303282b729d22dc0fc31d2080fc148900e392d81&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/303282b729d22dc0fc31d2080fc148900e392d81&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1756985" author="jesse" created="Wed, 20 Dec 2017 17:28:28 +0000"  >&lt;p&gt;The bad commit appears to be mine, &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/9f9934dcd9d7de3e7f8db315145106df44edee23&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;9f9934dcd&lt;/a&gt;, &quot;Check idle socket with ping&quot;, which I had suspected was the culprit. If this is truly the commit that hurt performance, it&apos;s probably because the driver is calling &quot;ping&quot; very often on the server, instead of calling &quot;ping&quot; only after 1 second of idleness.&lt;/p&gt;

&lt;p&gt;In that commit I changed mongoc_cluster_check_interval from calling &quot;ismaster&quot; after a second of idleness to &quot;ping&quot;, which is according to spec. But there&apos;s an unintended consequence: since I no longer process an ismaster response with mongoc_topology_scanner_ismaster_handler, I no longer update mongoc_topology_scanner_node_t.last_used. Therefore, every call to mongoc_cluster_check_interval believes the socket&apos;s been idle and it calls &quot;ping&quot; again.&lt;/p&gt;

&lt;p&gt;The solution is to find an appropriate place to update last_used.&lt;/p&gt;

&lt;p&gt;(I notice that, even before that commit, mongoc_cluster_check_interval had had a bug. Since last_used was only updated by mongoc_topology_scanner_ismaster_handler, that means mongoc_cluster_check_interval called &quot;ping&quot; on a socket a second after the last call to mongoc_cluster_check_interval, no matter what, instead of after a second of idleness. But that wasn&apos;t a noticeable performance hit.)&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="454933">CDRIVER-2343</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|htbstz:</customfieldvalue>

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