<br><br><div class="gmail_quote">On Wed, Oct 24, 2012 at 12:50 AM, Avi Bahra <span dir="ltr"><<a href="mailto:avibahra@gmail.com" target="_blank">avibahra@gmail.com</a>></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">> Currently I has a single threaded server based on boost ASIO.<br> > This works correctly most of the time.<br> > However on systems where i know that the disk's are slow.<br> > , the server grinds to a halt, when dealing with the blocking<br> > disk IO.<br> ><br> > I could not find any examples or documentation in ASIO, in<br> > how to get round these issues. It appears that ASIO does<br> > not provide any support for async' disk IO.<br> ><br> > So I assume this is handled by use of threads ?<br> > Are there any examples of using ASIO with threaded disk IO,<br> > since this must be very common use case ?<br> ><br> > Is the strand functionality appropriate for handing disk IO,<br> > in an async' manner.<br> ><br> > Any recommendations/advice on this issues would be<br> > greatly appreciated.<br> ><br> > Best regards,<br> > Ta,<br> > 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> ><br> <br> >Hi Avi,<br> ><br> >If your server performs short read/writ frequently and data to be transfer<br> >to network depend on these operations, then multi-threading does not help a<br> >lot here. I would suggest you to recheck your I/O strategies and make sure<br> >they are optimized. e.g. buffering, cache, .. etc. If they are perfect but<br> >performance still bother you, then consider to use memory mapped file or<br> >libaio.<br> ><br> >Best,<br> >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'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 'Services' 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>