4 ms·
> The biggest failure in this architecture was sharing sql queries as opposed to sharing service calls noob question but what do “sharing queries” and “sharing
by mebble 4y ago
> The biggest failure in this architecture was sharing sql queries as opposed to sharing service calls
noob question but what do “sharing queries” and “sharing service calls” mean?
- unoti 4y agoSuppose there are several different major components of a large system that need to know something about an important entity like a user for example. A good way to share that information is to have a user service that answers those questions (in a larger system) or a user library/data provider that does this (in a smaller system). A worse way to do that is to have sql queries that different systems use to get that data.
- phendrenad2 4y agoIsn't shared queries faster though?
- unoti 4y agoIt’s one less layer, so yes. But going thru a service gives you the opportunity to use caching, cache invalidation, or switch the operation to different kind of data store. So potentially it can be faster sometimes. Also if the database is occasionally burning up from being overworked then survival and reliability are much more important than speed.
- phendrenad2 4y agoA service layer is also a single point of failure. So if uptime is a concern, one less component that a developer can accidentally take out and bring down the whole system is valuable. One of the most pernicious dangers in shipping a successful project is you paradoxically both cargo cult and critique random parts of your success. Looking back, you might decide that choice A was correct, while choice B was incorrect. But you don't have the benefit of having tried all of those other options. So don't trust postmortems too much, they are single data points in a sea of failures. They could very well be random chance.