Alex: > Do you mean that a separate job, iterates the orders, accumulates the > real ordered quantity and subtracts it from some "initial quantity" in > order to produce available quantity? There are a few things we do: 1. When we place an order, we commit the order to the database in a transaction. 2. In a separate transaction, we reduce the qty available of the product by the amounts ordered. This transaction may be a conflict with other transactions. That is OK. 3. The inventory management system keeps the master inventory of the products. We have a continuous job that pulls the latest updates to the inventory and feeds those updates back to the web database. So, even if an inventory number is wrong for a short time, it will be updated to an accurate number soon. > What do you do in cases where you have oversold a product. I mean when > the "ordered quantity" got bigger than the "available quantity" due > to a conflict in available quantity field? I assume that the system > sends an email to the warehouse to increase additionally the quantity > of that product? If we oversell a product, we are going to either have to get more pronto or tell the customer we can't deliver it. The inventory numbers are updated often enough that we do not encounter it often. > Could you describe a case where a transaction has failed , and how you > deal with it? If a transaction fails on one endpoint, we try it against another endpoint. If it still fails, it depends on what the transaction was for. If it is not urgent (Like updating an inventory number) we send ourselves and alert and drop the transaction. If it is urgent, we notify the customer there was an error and send ourselves an alert. This happens very rarely. We also have monitoring on the state of the replication endpoints to make sure they are still active and are not having a problem communicating to the master. I hope this helps, Neil -- Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net/centos Virtual private server with CentOS 5.4 preinstalled for $25/month! Unmetered bandwidth = no overage charges, 7 day free trial