<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:37:09 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>[CSHARP-544] Asynchronous I/O while inserting documents</title>
                <link>https://jira.mongodb.org/browse/CSHARP-544</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;We need to know if there is a way to Asynchronously insert documents in mongo. We are currently using C# driver but if this feature is available in C++ driver then we can use that as well. We are currently calling&lt;/p&gt;</description>
                <environment></environment>
        <key id="47023">CSHARP-544</key>
            <summary>Asynchronous I/O while inserting documents</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="9">Done</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="zarian.waheed@rms.com">Zarian Waheed</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Tue, 14 Aug 2012 01:46:00 +0000</created>
                <updated>Fri, 5 Apr 2019 13:58:41 +0000</updated>
                            <resolved>Tue, 14 Aug 2012 03:39:35 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="160847" author="mikemcg" created="Wed, 5 Sep 2012 21:01:53 +0000"  >&lt;p&gt;For a quick comparison of async/IOCP-based code vs blocking code, see &lt;a href=&quot;http://stackoverflow.com/a/6230846/29805&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/a/6230846/29805&lt;/a&gt; . (Just substitute a MongoCollection.Find call for Thread.Sleep.)&lt;/p&gt;

&lt;p&gt;Without IOCP, ASP.NET can only handle 9 simultaneous requests at once this benchmark. With IOCP, ASP.NET can start asynchronously processing all requests almost simultaneously, leading to a 97% decrease in overall execution time!&lt;/p&gt;</comment>
                            <comment id="160836" author="mikemcg" created="Wed, 5 Sep 2012 20:49:17 +0000"  >&lt;p&gt;Just want to add that from my understanding of the OP, this sounds like a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-138&quot; title=&quot;Add asynchronous APIs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-138&quot;&gt;&lt;del&gt;CSHARP-138&lt;/del&gt;&lt;/a&gt;, and not something related to the server. As long as the server exposes a socket-based interface, Windows I/O completion ports can be leveraged by a driver to provide non-blocking consumption of it. .NET provides an easy-to-use API for IOCP. The C# driver, astonishingly, does not leverage this and fixing it is TBD.&lt;/p&gt;

&lt;p&gt;This should be marked a duplicate if for no other reason than to properly represent the growing desire for this feature, especially given the recent release of C# 5.0, .NET 4.5, and their emphasis on asynchronicity.&lt;/p&gt;</comment>
                            <comment id="153068" author="scotthernandez" created="Tue, 14 Aug 2012 03:39:35 +0000"  >&lt;p&gt;Yep, it is on our server/networking roadmap. Feel free to vote for the issues I linked to. Let us know if you have any other questions/comments &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="153065" author="zarian.waheed@rms.com" created="Tue, 14 Aug 2012 03:26:47 +0000"  >&lt;p&gt;Thanks. I think I have my answer. However it will be useful if you guys add support for true ASync I/O in the product. That way the client does not have to create additional threads for each insert request if they want the non blocking behavior. But thanks for your help. &lt;/p&gt;</comment>
                            <comment id="153064" author="scotthernandez" created="Tue, 14 Aug 2012 03:12:23 +0000"  >&lt;p&gt;The server does not support async io, and it processes requests sequentially on each socket. The client libraries which do support this just block on safe mode writes and use a different socket for future operations so they are non-blocking from the client perspective.&lt;/p&gt;

&lt;p&gt;These are worth reading: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-138&quot; title=&quot;Add asynchronous APIs&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-138&quot;&gt;&lt;del&gt;CSHARP-138&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-929&quot; title=&quot;use async network layer&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-929&quot;&gt;&lt;del&gt;SERVER-929&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I&apos;m not sure what you mean by light-weight; do you mean in terms of cpu/resource use/allocation while the client waits? Blocking on reading from network socket is pretty light-weight from the system perspective. If you want something which allows your program to continue you could use delegates and callback in C# (I&apos;m sure there are common patterns for this that could be adopted in your code).&lt;/p&gt;</comment>
                            <comment id="153054" author="zarian.waheed@rms.com" created="Tue, 14 Aug 2012 02:31:30 +0000"  >&lt;p&gt;We don&apos;t use C++ right now, I just wanted to know if there was anything available in C++ for Async I/O. We use the C# driver. From your response it seems like mongo does not support Asynchronous I/O or callbacks as all. I understand that I can use safemode = false which will not block the thread for the actual write to happen but is there a light weight way to know the status of that write operation later.&lt;/p&gt;</comment>
                            <comment id="153051" author="scotthernandez" created="Tue, 14 Aug 2012 02:23:22 +0000"  >&lt;p&gt;What C++ calls are you using which you consider async? Is this using the c++ driver provided with the server? &lt;/p&gt;

&lt;p&gt;The server doesn&apos;t support callbacks or async operations so I&apos;m not sure how this works now. When you call a write operation it will be sent and there is no response, the getLastError call is used immediately after the write call to block and wait for completion. Using safemode:true does this under the covers.&lt;/p&gt;

&lt;p&gt;If you don&apos;t want to get an acknowledgment of the write then the default mode of fire&apos;n&apos;forget in non-safe mode will do what you want.&lt;/p&gt;</comment>
                            <comment id="153048" author="zarian.waheed@rms.com" created="Tue, 14 Aug 2012 01:46:43 +0000"  >&lt;p&gt;Adding the complete question:&lt;/p&gt;

&lt;p&gt;We need to know if there is a way to Asynchronously insert documents in mongo. We are currently using C# driver but if this feature is available in C++ driver then we can use that as well. We are currently calling MongoDB.Driver.MongoCollection&amp;lt;TDefaultDocument&amp;gt;.InsertBatch(..) with safemode = true. This function waits till all the documents are added in the collection before returning back to the caller. Is there a way to call this function Asynchronously and provide a callback that will be invoked when the call actually completes.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="14042">CSHARP-138</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="10815">SERVER-929</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|hrh4gv:</customfieldvalue>

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