If we have replication-factor 2, then how is the replica record written on other node. Does the client first writes to master node and then master node sends it to replica node and acknowledges client. Or client writes both master and replica in parallel and waits until both have acknowledged?
By default, writes in Aerospike are written to replica’s (depending on your replication factor) synchronously. So, your first point is true - client writes to master, master writes to replica, once the replica is acknowledged, master acknowledges the client marking the transaction as completed.
You can however make the replica writes go asynchronously by setting the write-commit-level-override to master.
More information on transaction consistency: http://www.aerospike.com/docs/architecture/consistency.html