<div dir="ltr">Hi Edward, <div><br></div><div style>I did two things to improve latency for my application: (1) rework the IO manager and (2) stabilize the work pushing. (1) seems like a big win and we are almost done with the work on that part. It is less clear whether (2) will generally help much. It helped me when I developed it against 7.4.1, but it doesn&#39;t seem to have much impact on HEAD on the few measurements I did. The idea of (2) was to keep running averages of the run queue length of each capability, then push work when these running averages get too out-of-balance. The desired effect (which seems to work on my particular application) is to avoid cases in which threads are pushed back and forth among cores, which may make cache usage worse. You can see my patch here: <a href="https://github.com/AndreasVoellmy/ghc-arv/commits/push-work-exchange-squashed">https://github.com/AndreasVoellmy/ghc-arv/commits/push-work-exchange-squashed</a>. </div>
<div style><br></div><div style>-Andi</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 12:10 AM, Edward Z. Yang <span dir="ltr">&lt;<a href="mailto:ezyang@mit.edu" target="_blank">ezyang@mit.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey folks,<br>
<br>
The latency changes sound relevant to some work on the scheduler I&#39;m doing;<br>
is there a place I can see the changes?<br>
<br>
Thanks,<br>
Edward<br>
<br>
Excerpts from Simon Peyton-Jones&#39;s message of Wed Feb 06 10:10:10 -0800 2013:<br>
<div class="im HOEnZb">&gt; I (with help from Kazu and helpful comments from Bryan and Johan) have nearly completed an overhaul to the IO manager based on my observations and we are in the final stages of getting it into GHC<br>

&gt;<br>
&gt; This is really helpful. Thank you very much Andreas, Kazu, Bryan, Johan.<br>
&gt;<br>
&gt; Simon<br>
&gt;<br>
&gt; From: <a href="mailto:parallel-haskell@googlegroups.com">parallel-haskell@googlegroups.com</a> [mailto:<a href="mailto:parallel-haskell@googlegroups.com">parallel-haskell@googlegroups.com</a>] On Behalf Of Andreas Voellmy<br>

&gt; Sent: 06 February 2013 14:28<br>
&gt; To: <a href="mailto:watson.timothy@gmail.com">watson.timothy@gmail.com</a><br>
&gt; Cc: <a href="mailto:kostirya@gmail.com">kostirya@gmail.com</a>; parallel-haskell; <a href="mailto:glasgow-haskell-users@haskell.org">glasgow-haskell-users@haskell.org</a><br>
&gt; Subject: Re: Cloud Haskell and network latency issues with -threaded<br>
&gt;<br>
&gt; Hi all,<br>
&gt;<br>
&gt; I haven&#39;t followed the conversations around CloudHaskell closely, but I noticed the discussion around latency using the threaded runtime system, and I thought I&#39;d jump in here.<br>
&gt;<br>
&gt; I&#39;ve been developing a server in Haskell that serves hundreds to thousands of clients over very long-lived TCP sockets. I also had latency problems with GHC. For example, with 100 clients I had a 10 ms (millisecond) latency and with 500 clients I had a 29ms latency. I looked into the problem and found that some bottlenecks in the threaded IO manager were the cause. I made some hacks there and got the latency for 100 and 500 clients down to under 0.2 ms. I (with help from Kazu and helpful comments from Bryan and Johan) have nearly completed an overhaul to the IO manager based on my observations and we are in the final stages of getting it into GHC. Hopefully our work will also fix the latency issues in CloudHaskell programs :)<br>

&gt;<br>
&gt; It would be very helpful if someone has some benchmark CloudHaskell applications and workloads to test with. Does anyone have these handy?<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Andi<br>
&gt;<br>
</div><div class="im HOEnZb">&gt; On Wed, Feb 6, 2013 at 9:09 AM, Tim Watson &lt;<a href="mailto:watson.timothy@gmail.com">watson.timothy@gmail.com</a>&lt;mailto:<a href="mailto:watson.timothy@gmail.com">watson.timothy@gmail.com</a>&gt;&gt; wrote:<br>

&gt; Hi Kostirya,<br>
&gt;<br>
&gt; I&#39;m putting the parallel-haskell and ghc-users lists on cc, just in case other (better informed) folks want to chip in here.<br>
&gt;<br>
&gt; ----<br>
&gt;<br>
&gt; First of all, I&#39;m assuming you&#39;re talking about network latency when compiling with -threaded - if not I apologise for misunderstanding!<br>
&gt;<br>
&gt; There is apparently an outstanding network latency issue when compiling with -threaded, but according to a conversation I had with the other developers on #haskell-distributed, this is not something that&#39;s specific to Cloud Haskell. It is something to do with the threaded runtime system, so would need to be solved for GHC (or is it just the Network package!?) in general. Writing up a simple C program and equivalent socket use in Haskell and comparing the latency using -threaded will show this up.<br>

&gt;<br>
&gt; See the latency section in <a href="http://haskell-distributed.github.com/wiki/networktransport.html" target="_blank">http://haskell-distributed.github.com/wiki/networktransport.html</a> for some more details. According to that, there *are* some things we might be able to do, but the 20% latency isn&#39;t going to change significantly on the face of things.<br>

&gt;<br>
&gt; We have an open ticket to look into this (<a href="https://cloud-haskell.atlassian.net/browse/NTTCP-4" target="_blank">https://cloud-haskell.atlassian.net/browse/NTTCP-4</a>) and at some point we&#39;ll try and put together the sample programs in a github repository (if that&#39;s not already done - I might&#39;ve missed previous spikes done by Edsko or others) and investigate further.<br>

&gt;<br>
&gt; One of the other (more experienced!) devs might be able to chip in and proffer a better explanation.<br>
&gt;<br>
&gt; Cheers,<br>
&gt; Tim<br>
&gt;<br>
</div><div class="HOEnZb"><div class="h5">&gt; On 6 Feb 2013, at 13:27, <a href="mailto:kostirya@gmail.com">kostirya@gmail.com</a>&lt;mailto:<a href="mailto:kostirya@gmail.com">kostirya@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Haven&#39;t you had a necessity to launch Haskell in no-threaded mode during the intense network data exchange?<br>
&gt; &gt; I am getting the double performance penalty in threaded mode. But I must use threaded mode because epoll and kevent are available in the threaded mode only.<br>
&gt; &gt;<br>
&gt;<br>
&gt; [snip]<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; среда, 6 февраля 2013 г., 12:33:36 UTC+2 пользователь Tim Watson написал:<br>
&gt; &gt; Hello all,<br>
&gt; &gt;<br>
&gt; &gt; It&#39;s been a busy week for Cloud Haskell and I wanted to share a few of<br>
&gt; &gt; our news items with you all.<br>
&gt; &gt;<br>
&gt; &gt; Firstly, we have a new home page at <a href="http://haskell-distributed.github.com" target="_blank">http://haskell-distributed.github.com</a>,<br>
&gt; &gt; into which most of the documentation and wiki pages have been merged. Making<br>
&gt; &gt; sassy looking websites is not really my bag, so I&#39;m very grateful to the<br>
&gt; &gt; various author&#39;s whose Creative Commons licensed designs and layouts made<br>
&gt; &gt; it easy to put together. We&#39;ve already had some pull requests to fix minor<br>
&gt; &gt; problems on the site, so thanks very much to those who&#39;ve contributed already!<br>
&gt; &gt;<br>
&gt; &gt; As well as the new site, you will find a few of us hanging out on the<br>
&gt; &gt; #haskell-distributed channel on freenode. Please do come along and join in<br>
&gt; &gt; the conversation.<br>
&gt; &gt;<br>
&gt; &gt; We also recently split up the distributed-process project into separate<br>
&gt; &gt; git repositories, one for each component that makes up Cloud Haskell. This<br>
&gt; &gt; was done partly for administrative purposes and partly because we&#39;re in the<br>
&gt; &gt; process of setting up CI builds for all the projects.<br>
&gt; &gt;<br>
&gt; &gt; Finally, we&#39;ve moved from Github&#39;s issue tracker to a hosted Jira/Bamboo setup<br>
&gt; &gt; at <a href="https://cloud-haskell.atlassian.net" target="_blank">https://cloud-haskell.atlassian.net</a> - pull requests are naturally still welcome<br>
&gt; &gt; via Github! Although you can browse issues freely without logging in, you will<br>
&gt; &gt; need to provide an email address and get an account in order to submit new ones.<br>
&gt; &gt; If you have any difficulties logging in, please don&#39;t hesitate to contact me<br>
&gt; &gt; directly, via this forum or the cloud-haskell-developers mailing list (on<br>
&gt; &gt; google groups).<br>
&gt; &gt;<br>
&gt; &gt; As always, we&#39;d be delighted to hear any feedback!<br>
&gt; &gt;<br>
&gt; &gt; Cheers,<br>
&gt; &gt; Tim<br>
&gt;<br>
</div></div></blockquote></div><br></div>