I would like to build a fault-tolerant soft real-time web application for a pizza delivery shop. It should help the pizza shop to accept phone calls from customers, put them as orders into the system (via a CRM web client) and help the dispatchers to assign delivery drivers to the orders.
These goals are nothing unusual, but I would like to make the service available 24/7, i.e. to make it fault-tolerant. Moreover, I would like to make it work very fast and to be very responsive.
Below is a very simple architecture view for such an application.
The problem is that I do not know how to use all of the Erlang/OTP goodness to make the application very responsive and fault tolerant.
Here are my questions:
- Which system elements should be replicated in order to provide fault-tolerance and how should I do that? I know that I can store the status of each vehicle (coordinates, assigned orders, etc.) in a replicated Mnesia database. Is that a right way to go?
- Which data-storage services should be conventional SQL-based (e.g. based on boss_db) and which should be done on Mnesia to provide for very fast response? Is it ok to use a conventional SQL database to store customer records and history in a such fault-tolerant and highly-responsive application?
- Should I try to store all the data for all the services (customers, vehicles status, etc.) in RAM in order to make the application highly-responsive?
- Should I store the persistent vehicle data (id, capacity, etc.) in a conventional SQL database and store the real-time data (coordinates, assigned orders, orders in the trunk, etc.) in a Mnesia database to make the application more real-time responsive?