<br><br><div class="gmail_quote">On Wed, Oct 24, 2012 at 12:50 AM, Avi Bahra <span dir="ltr">&lt;<a href="mailto:avibahra@gmail.com" target="_blank">avibahra@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">&gt; Currently I has a single threaded server based on boost ASIO.<br>
&gt; This works correctly most of the time.<br>
&gt; However on systems where i know that the disk&#39;s are slow.<br>
&gt; , the server grinds to a halt, when dealing with the blocking<br>
&gt; disk IO.<br>
&gt;<br>
&gt; I could not find any examples or documentation in ASIO, in<br>
&gt; how to get round these issues. It appears that ASIO does<br>
&gt; not provide any support for async&#39; disk IO.<br>
&gt;<br>
&gt; So I assume this is handled by use of threads ?<br>
&gt; Are there any examples of using ASIO with threaded disk IO,<br>
&gt; since this must be very common use case ?<br>
&gt;<br>
&gt; Is the strand functionality appropriate for handing disk IO,<br>
&gt; in an async&#39; manner.<br>
&gt;<br>
&gt; Any recommendations/advice on this issues would be<br>
&gt; greatly appreciated.<br>
&gt;<br>
&gt; Best regards,<br>
&gt; Ta,<br>
&gt;     Avi<br>
&gt; _______________________________________________<br>
&gt; Boost-users mailing list<br>
&gt; <a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
&gt; <a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
&gt;<br>
<br>
&gt;Hi Avi,<br>
&gt;<br>
&gt;If your server performs short read/writ frequently and data to be transfer<br>
&gt;to network depend on these operations, then multi-threading does not help a<br>
&gt;lot here. I would suggest you to recheck your I/O strategies and make sure<br>
&gt;they are optimized. e.g. buffering, cache, .. etc. If they are perfect but<br>
&gt;performance still bother you, then consider to use memory mapped file or<br>
&gt;libaio.<br>
&gt;<br>
&gt;Best,<br>
&gt;Acer.<br>
<br>
</div></div>In my  case the ASIO server needs to only write to a local disk.(no reads)<br>
One write is relatively short, i.e to a log file, to record all requests,<br>
the other is to write periodically a in memory node tree.<br>
This can vary between 1-100MB.<br>
My thinking was that if I used a thread reserved for writing the<br>
node tree, it will not block the server from handling requests,<br>
 on slow file systems.<br>
<br>
I will look into memory mapped files and libaio.<br>
<div class="HOEnZb"><div class="h5"><br>
Ta, Avi<br>
_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
<a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
</div></div></blockquote></div><div><br></div><div>Log is a good candidate to be improved. You can look into asio&#39;s document.</div><div><br></div><div>Here is an online version</div><div><a href="http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/examples.html">http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/examples.html</a><br>
</div><div><br></div><div>These documents are included in every boost distribution.</div><div><br></div><div>The &#39;Services&#39; section involves a simple logger service which can perform write</div><div>operation in a background thread. Furthermore, you can also wrap your large </div>
<div>write operation as a service to achieve shorter response time. </div><div><br></div><div>Best,</div><div>Acer.</div>