I agree with you andagreed. I have the very same feeling of rejection when it comes to calling external processesservices. However, howHow @Telastyn answeredsay, some times is necessary. So so worth doing a bit of research to knowmeet in deep the tools and the alternatives at hand.
@Telastyn hasalso mentioned caches. In line with thishis argument, I would suggest meeting your tools in deep first, because some of the libraries, drivers and protocolsthem implement cache out of the box. It's the case of some DB drivers, WWW architecture, ERM, frameworks, etc.
For example, if ...
given the fact that they could be used multiple times
You have to research ifResearch whether your DB or your, driver, ERM or framework is already caching statements. If they do, probably many of the validation queries you execute are going towill be cached eventually. For a while. The same applies to HTTP requests (if you set the proper headers).
However, working with caches can be painful, overall if we don't understand how, when and what is invalidated.
Regarding performance, often we put the focus on it too earlysoon. It's preferableStart implementing first the easiest and obvious solution first, perform load tests, monitoring the system and get real metrics. Then you arewill be in a better position to make good decisions because these will be ground upon objective inputsand backed by data.
To finish, when it comes to communication failures, worth knowing patterns and strategies such as. For example Circuit Breaker, Retry or Fail Fast. TheyThese won't save you from the Fallacies of the Distributed Computing, but they can keep the actual solution simple and reliable.
Summarising. If, if you can avoid it, then dotdo it. If you can't, start implementing the easiest solutionwith meeting your resources at hand, implement something simple and test it. Then look for enhancements or alternatives if need it. The key is having resources, a toolbox to work on this sort of situations with some degree of confidence.
Most of the time the best solution is not the one that most likes us. It's the one that works, the simplest and reliable. Performance is not a problem most of the times. Connection errors should be expected (always, anytime), the solution then is an adequate error handling strategy.