mardi 26 septembre 2017

DAO as Service vs DAO as Library

I have 3 different services which needs to access same database. Each of these service will serve different purpose and different queries. I can generalize them in following way

  1. Service 1 -> Customer Inquires
  2. Service 2 -> Order Processor (e.g.workflow for placed orders)
  3. Service 3 -> Reporting

I have written a DAO to expose data. I am evaluating two system designs for scalability and maintenance.

Option 1: Write one more service to expose DAO functionality as Data Service.

Pros: - Load on database will be controlled and easy to scale-in/out as needed - Easy to maintain for future updates - Access control for various actions - clients doesn't have full access on underlying database

Cons: - single point of failure - management of extra service - Need to enforce backward compatibility rules - In case of DataService downtime every service is affected (factors other than database downtime)

And

Option 2: Create a storage library out of DAO and use these library in above mentioned three services.

Pros: - distributed, impact radius is very small

Cons: - Every service get full access on database - Needs to update all three services for new features

Which option is good and why? Any other ideas/architecture designs to consider? What are the things I need to consider when choosing architecture?

Aucun commentaire:

Enregistrer un commentaire