<div dir="ltr"><div dir="ltr">On Fri, Feb 1, 2019 at 7:54 AM Vijay Bellur &lt;<a href="mailto:vbellur@redhat.com">vbellur@redhat.com</a>&gt; wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 31, 2019 at 10:01 AM Xavi Hernandez &lt;<a href="mailto:xhernandez@redhat.com" target="_blank">xhernandez@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi,<div><br></div><div>I&#39;ve been doing some tests with the global thread pool [1], and I&#39;ve observed one important thing:</div><div><br></div><div>Since this new thread pool has very low contention (apparently), it exposes other problems when the number of threads grows. What I&#39;ve seen is that some workloads use all available threads on bricks to do I/O, causing avgload to grow rapidly and saturating the machine (or it seems so), which really makes everything slower. Reducing the maximum number of threads improves performance actually. Other workloads, though, do little I/O (probably most is locking or smallfile operations). In this case limiting the number of threads to a small value causes a performance reduction. To increase performance we need more threads.</div><div><br></div><div>So this is making me thing that maybe we should implement some sort of I/O queue with a maximum I/O depth for each brick (or disk if bricks share same disk). This way we can limit the amount of requests physically accessing the underlying FS concurrently, without actually limiting the number of threads that can be doing other things on each brick. I think this could improve performance.</div></div></div></blockquote><div><br></div><div>Perhaps we could throttle both aspects - number of I/O requests per disk and the number of threads too?  That way we will have the ability to behave well when there is bursty I/O to the same disk and when there are multiple concurrent requests to different disks. Do you have a reason to not limit the number of threads?</div></div></div></blockquote><div><br></div><div>No, in fact the global thread pool does have a limit for the number of threads. I&#39;m not saying to replace the thread limit for I/O depth control, I think we need both. I think we need to clearly identify which threads are doing I/O and limit them, even if there are more threads available. The reason is easy: suppose we have a fixed number of threads. If we have heavy load sent in parallel, it&#39;s quite possible that all threads get blocked doing some I/O. This has two consequences:</div><div><ol><li>There are no more threads to execute other things, like sending answers to the client, or start processing new incoming requests. So CPU is underutilized.</li><li>Massive parallel access to a FS actually decreases performance</li></ol><div>This means that we can do less work and this work takes more time, which is bad.</div></div><div><br></div><div>If we limit the number of threads that can actually be doing FS I/O, it&#39;s easy to keep FS responsive and we&#39;ll still have more threads to do other work.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div><br></div><div>Maybe this approach could also be useful in client side, but I think it&#39;s not so critical there.</div></div></div></blockquote><div><br></div><div>Agree, rate limiting on the server side would be more appropriate.</div></div></div></blockquote><div><br></div><div>Only thing to consider here is that if we limit rate on servers but clients can generate more requests without limit, we may require lots of memory to track all ongoing requests. Anyway, I think this is not the most important thing now, so if we solve the server-side problem, then we can check if this is really needed or not (it could happen that client applications limit themselves automatically because they will be waiting for answers from server before sending more requests, unless the number of application running concurrently is really huge).</div><div><br></div><div>Xavi</div></div></div>