I'm working on a relatively large system, that is about online transportation reservation. The system is decomposed into some services, that are interacting via REST interface with each other and the UI.

I have a service, called BillingService, that is responsible for establishing, payment and finalization of bills. Each bill can consist of different reservations, like flight, train, bus, etc. Each of these items have a completely different business logic, procedure and models, and each of them is managed in a different service, and BillingService is playing an orchestration role between them.

We have a panel for our customers and operators, to see the list of their bills, and reservations inside it. Each reservation has its special details that must be fetched from the respective service, and bill service has no idea about that.

Now, assume that in the middle of the day, the operator's panel is filled with more than 40 bills, each having some reservation items, and its status must be updated in real time. Currently we are using an SQL query to join bills table with reservation tables and return the result and it is a fast and straight-forward action, but obviously, it is in conflict with the principle of single responsibility of BillingService. The right solution (from the design point of view) would be to fetch reservation details from their services, but its performance and response time will not be acceptable, as we have to issue hundreds of requests to the reservation services to get details.

As we are planning to add more types of reservation (that have the same criteria as others) to the system, the current design (accessing reservation database directly in BillingSerice) seems like a headache now, and the other way (fetching reserve details from their services) seems not be practical, because of large amount of communication and requests that are involved.

Is there some solution that considers performance and design simultaneously, that I'm not seeing?

1 Answer 1


One way (whether this fits your environment is up to you) is decoupling the BillingService by giving it its own data storage:

  • Set up a system where the various reservation services propagate the data which is necessary for the billing service
  • Set the billing service as a receiver for these data updates
  • Store the data in the billing service itself


  • The billing service can now operate without a live connection to the reservation services (and thus becomes a standalone service)
  • The billing service will even continue to work, when one of the reservation services goes down and is unreachable
  • As there's no more live communication, your performance problem is solved


  • Data in the billing service may be stale
  • More infrastructure (usually at least a message bus with message persistence)
  • As part of this: think carefully about which details are always shown to the operator/user and which details can be retrieved on-demand. Jun 24, 2020 at 12:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.