mail-archives/mono-bugs/2010-July/102625.html

91 строка
4.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20624849%5D%20BlockingCollection%3CT%3E%20takes%20100%25%20cpu%20when%0A%20blocking%20for%20an%20element&In-Reply-To=bug-624849-28286%40http.bugzilla.novell.com/">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="102624.html">
<LINK REL="Next" HREF="102627.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20624849%5D%20BlockingCollection%3CT%3E%20takes%20100%25%20cpu%20when%0A%20blocking%20for%20an%20element&In-Reply-To=bug-624849-28286%40http.bugzilla.novell.com/"
TITLE="[Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element">bugzilla_noreply at novell.com
</A><BR>
<I>Sat Jul 31 16:36:15 EDT 2010</I>
<P><UL>
<LI>Previous message: <A HREF="102624.html">[Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element
</A></li>
<LI>Next message: <A HREF="102627.html">[Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#102625">[ date ]</a>
<a href="thread.html#102625">[ thread ]</a>
<a href="subject.html#102625">[ subject ]</a>
<a href="author.html#102625">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="http://bugzilla.novell.com/show_bug.cgi?id=624849">http://bugzilla.novell.com/show_bug.cgi?id=624849</A>
<A HREF="http://bugzilla.novell.com/show_bug.cgi?id=624849#c7">http://bugzilla.novell.com/show_bug.cgi?id=624849#c7</A>
--- Comment #7 from J&#233;r&#233;mie LAVAL &lt;<A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">jeremie.laval at gmail.com</A>&gt; 2010-07-31 20:36:13 UTC ---
(In reply to comment #6)
&gt;<i> This reduces cpu usage to alot on this machine. However, when comparing
</I>&gt;<i> BlockingCollection (mono master) running on .net, with the built-in .net 4
</I>&gt;<i> BlockingCollection, the mono version takes about 2% cpu, while the built-in
</I>&gt;<i> does not show up at all (less than 1%).
</I>
This is all about tuning up number limit hence why I was asking. I will lower
it a bit more.
&gt;<i> I looked at the code and it seems there are no usage at all of any signaling or
</I>&gt;<i> something. The .net version probably uses ManualResetEventSlim or SemaphoreSlim
</I>&gt;<i> to actually sleep until it is signaled (by adding an element). The mono one
</I>&gt;<i> just spins alot which is plain wrong. (spinning should afaict only be used in a
</I>&gt;<i> short while before actually waiting, but this behaviour is built-in to
</I>&gt;<i> ManualResetEventSlim and SemaphoreSlim)
</I>
The *Slim things are designed to not use kernel objects or too much kernel
level function so their stalling part is not as good as a real kernel object
which is exactly their purpose i.e. having an object with the same behavior but
for short lived wait not requiring any costly kernel operations. IMHO
BlockingCollection has kinda the same spirit that is having maximal throughput
between a producer (which when finished use AddingComplete) and a consumer
which isn't the case in your scenario where I wouldn't use such collection.
--
Configure bugmail: <A HREF="http://bugzilla.novell.com/userprefs.cgi?tab=email">http://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="102624.html">[Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element
</A></li>
<LI>Next message: <A HREF="102627.html">[Mono-bugs] [Bug 624849] BlockingCollection&lt;T&gt; takes 100% cpu when blocking for an element
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#102625">[ date ]</a>
<a href="thread.html#102625">[ thread ]</a>
<a href="subject.html#102625">[ subject ]</a>
<a href="author.html#102625">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>