Hi,<br><br>    First of all, is that necessary to log every SQL expression even if it may successfully commit to the database? I suppose you could benefit from "log only error" strategy.<br><br>    Although I don't really know prim_file thing, but from my personal experience, you may use "lagger" or "log4erl" or the log modules from "ejabbered", that may resolve your problem.<br>
<br><br><div class="gmail_quote">2011/8/7 达达 <span dir="ltr"><<a href="mailto:bg5sbk@qq.com">bg5sbk@qq.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<p>Hi.</p>
<p>In my game project, I use ETS mapping mysql and use two process sync the ETS table's changes to mysql.</p>
<p>One process generate SQL and write to a log file and then send SQL to another process to execute.</p>
<p>In recent days, I got a problem. After some unknow thing happen (look like always happen on busy node). The SQL log process run into very very slow and no recovery.</p>
<p>When this happen, I must disconnect all players and suspend the SQL log process and copy the messages to SQL execute process, after all action sync, restart the node. :(</p>
<p>And when this happen, I always can get:</p>
<p>    {current_function,{prim_file,translate_response,2}}</p>
<p>by:</p>
<p>    process_info(SqlLogProc, current_function). </p>
<p>I think something make the "translate_response" take very very long time so the log file write very very slow.</p>
<p>The log file open by:</p>
<p>    file:open(FileName, [append, raw, {delayed_write, 1024 * 1000 * 10, 6000}]).</p>
<p>and write by:</p>
<p>    file:write(File, SQL).</p>
<p>I use R14B3 on server.</p>
<p>Is it a bug of erlang's prim_file module? or what can I optimize?</p>
<p>I have 350+ game server node and add 15 ~ 20 node every day, this problem happens on 1 ~ 2 node every day, and make me crazy I need sleep :(</p><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br>