<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:39:56 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-1544] System.TimeoutException: when using more than 10 tasks</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1544</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;Hello, I am trying to insert the documents into the MongoDB using the Task.Run functionality. When I am creating 10 tasks everything works fine, but if there are for example 50 tasks created then I get the System.TimeoutException.&lt;br/&gt;
I attached the archive with solution that I created for testing purposes.&lt;br/&gt;
Could you please help me to resolve this issue?&lt;br/&gt;
I want to create 1000 tasks and each task inside should do 10000 inserts.&lt;/p&gt;</description>
                <environment>Windows 7, MongoDB v3.0.6</environment>
        <key id="260195">CSHARP-1544</key>
            <summary>System.TimeoutException: when using more than 10 tasks</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="roman1196">Roman</reporter>
                        <labels>
                            <label>question</label>
                    </labels>
                <created>Fri, 22 Jan 2016 13:54:07 +0000</created>
                <updated>Fri, 5 Apr 2019 13:59:07 +0000</updated>
                            <resolved>Tue, 26 Jan 2016 14:06:31 +0000</resolved>
                                                                    <component>Connectivity</component>
                    <component>Error Handling</component>
                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="1153847" author="roman1196" created="Tue, 26 Jan 2016 14:05:07 +0000"  >&lt;p&gt;Hi Craig,&lt;/p&gt;

&lt;p&gt;Thank you for fast response. &lt;br/&gt;
I changed the method to return a Task and changed the driver method to InsertOneAsync. It seems that it resolved my issue with the TimeOutException. &lt;br/&gt;
After some tests I was able to rich the number of 500 Tasks, probably this is the normal number for my PC. Also I tested this solution in my real web application and it works fine.&lt;br/&gt;
You can close this task.&lt;/p&gt;

&lt;p&gt;Thank you very much!&lt;/p&gt;</comment>
                            <comment id="1151191" author="craiggwilson" created="Fri, 22 Jan 2016 15:17:01 +0000"  >&lt;p&gt;First off, I could not replicate any issues. I even went up to 1000 and had no trouble. So, some statements:&lt;/p&gt;

&lt;p&gt;I&apos;ve noticed you increased the defaults this should help when under high loads. However, this is a console application. If you were to profile the speed of your inserts, you&apos;d find that increasing the thread count to 1000 ultimately hurts performance. You are constrained by the number of cores you have on your machine. In addition, this seems to be a semi-concocted perf test with somewhat arbitrary input. It would be helpful to know what your actual workload is rather than inserting a bunch of instantiated error logs as fast as possible. Where are these error logs coming from? Are you likely to be constrained on ingestion speed as well?&lt;/p&gt;

&lt;p&gt;Anyways...&lt;/p&gt;

&lt;p&gt;1. What can help with this is to use asynchronous inserts. This is simple enough with the driver by changing your InsertObject method to return a task and internally calling InsertOneAsync. This will let your local computer utilize resources better while network IO is going on. Note that async tends to be a bit slower individually, but ultimately can yield a higher throughput.  &lt;/p&gt;

&lt;p&gt;2. Instead of picking something arbitrarily high (like 1000), start low, measure, and increase your thread count until you start to get a decline in throughput. That is your magic number.&lt;/p&gt;

&lt;p&gt;3. Consider using Parallel.For instead of a for loop composed of Task.Run.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="106235" name="MongoDbAnalysis.7z" size="1179182" author="roman1196" created="Fri, 22 Jan 2016 13:54:07 +0000"/>
                    </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|hshm6v:</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>