<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi all,<div><br></div><div>I am experiencing a problem that in my program, executing some background operations seems to slow down other operations running in foreground….</div><div><br></div><div>I am implementing a transactional datastore on top of Erlang. A transaction reads bunches of data (read phase) and then enters a commit phase that write data to the data store. To provide fault tolerance, in the commit phase, written data is synchronously replicated to a few Erlang nodes, running in different physical machines. Client is notified after the replication is finished. </div><div><br></div><div>Since replication is slow, I make replication asynchronous: client is notified as soon as the data is written to its local node and the replication process just continues running.</div><div>Ideally, this should improve throughput, as now the client doesn’t wait replication to finish and can execute more operations. However, I benchmarked with 1 thread as client and I don’t see difference in the throughput between synchronous mode and asynchronous mode.</div><div><br></div><div>After checking more carefully of the metrics, I found that the commit phase of asynchronous mode is faster than before, but somehow the read phase becomes slower. The following are the average executing time for read and commit in microsecond of these two modes:</div><div>Synchronous:  Read <b>8381</b> Commit <b>4529</b></div><div>Asynchronous: Read  <b>10874</b> Commit <b>1287</b></div><div><br></div><div>Machines are not overloaded yet, because each machine has <b>2 CPUs</b> and the CPU utilization for datastore is only about <b>75%</b>. And read and replication is totally decoupled: client only accesses a data storage fsm to read; replication is handled by individual replication fsms, so data storage fsm won’t be bothered (and possibly slowed down) during replication. I can only guess that it might be related with scheduling or asynchronous threads, but I couldn’t solve it so far….</div><div><br></div><div>Any suggestions and help are really appreciated! Thank you in advance!</div><div><br></div><div>Thank you,</div><div>Li</div><div><br></div><div><br></div></body></html>