CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 4 of 7 · 2 min read

Strengths, limits and the sinkhole

Cheap and simple at first, harder to change and scale as it grows.

Think of a small shop run from one till. It is cheap and everyone knows how it works. As the shop grows to a department store, a single till and a single stockroom turn into a bottleneck.

FSA rates the layered style on the characteristics from Level 0, page 5, on a scale from one to five stars. The text states these ratings:

Characteristic Rating in the book Why
Overall cost and simplicity Strong No network, easy to understand, cheap to build and run
Deployability Very low A three-line change means redeploying everything, with other changes bundled in, so risk is high and deployments are rare
Testability Low (two stars) Hard to run full regression for every small change, though layers can be mocked
Reliability Medium (three stars) No network faults, but deployment risk and weak testing
Elasticity and scalability Very low (one star) The whole unit must be scaled together, and there is little modularity inside

The book warns that the ratings drop quickly as a layered monolith gets bigger.

When is it a good choice? For small, simple applications; for a very tight budget and deadline; and when the team is still learning the business needs and does not yet know the right style. As the application grows, maintainability, agility, testability and deployability suffer, and a more modular style fits better. The book recommends, when using a layered monolith as a starting point before deciding on microservices, to keep reuse low and inheritance chains shallow so a later move is easier.

The architecture sinkhole. This anti-pattern appears when requests pass through layer after layer doing no work. A request for a customer's name and address goes from presentation to business to rules to persistence to the database, with each layer just forwarding it. Memory and time are wasted.

Every layered system has some such requests. The test is the proportion. The book's 80-20 rule: it is acceptable if 20 percent of requests are sinkholes. If 80 percent are, the style does not suit the problem. One remedy is to open the layers, at the cost of harder change.

A worked example (made up). A team traces 1,000 requests over a day.

Type of request Count Business logic in the middle layers?
Simple lookups 700 None
Orders, refunds, reports 300 Yes

70 percent are sinkholes. That is far above the 20 percent guide. The team might open the layers for lookups, or reconsider the style.

Architecture sinkhole anti-pattern

The architecture sinkhole is a pattern where most requests flow through all layers as plain pass-through, with no processing in the layers.

Example: a "get customer name" request that each layer forwards unchanged to the next.

Check yourself:

  • Name the characteristic where the layered style is strongest and two where it is weakest.
  • In the example, what share of requests are sinkholes, and what does that suggest?