Skip to content

SoftwareDecision guide

Does your app need microservices and Kubernetes? Usually not yet, and how you'll know

Microservices, Kubernetes and sharding each solve a real problem, and each adds parts someone has to run. Here is how to tell whether your app has that problem yet.

On this page

Do you need microservices? Probably not yet. In our view, most business apps run well as one application on one database, deployed simply. Microservices, Kubernetes and a sharded database solve the problems of large teams and very large load. Added early, they bring moving parts and specialist upkeep before they bring any benefit.

We build web applications as part of our custom software development work, and we would start most of them as one application. This is architecture guidance, not a universal rule. What fits depends on your data, your load and who will run the system.

Start with one application and one database

In our view, one application on one database is the sound default for a new app, and for most apps that serve one business. It has the fewest parts to deploy, watch and repair. Each heavier piece below answers a specific problem.

Caching, which appears in the tables too, means keeping the answer to a frequent request in fast memory, so the database is not asked every time.

Do you need microservices, Kubernetes or sharding?

Your app needs a heavier piece only when a signal you can measure points to it. Find the rows that are true for you today.

When each piece earns its place
If this is trueThen
You are building a new app, or the app serves one business with one team working on itOne application and one database, deployed simply. Spend the effort on the product.
You want the app to run the same way on every developer's machine and on the serverContainers, such as Docker. A small step, and easy to undo.
A measurement shows the database is slow because of reads, after slow queries have been fixedCaching, then a read replica. Both take load off the main database without changing how data is stored.
You run many containers across several servers, and failed ones must be replaced and traffic spread without anyone stepping inAn orchestrator, such as Kubernetes, or a host that does this for you.
Several teams change the same code and block each other's releases, or one part must be released or scaled on its ownSplit that one part out as a separate service. Keep the rest together.
The data or the write load is more than one database server can take, even after a larger server, partitioning and replicasShard, with a written plan for how data is split and moved.
Leave it aloneThe app serves its users without slowdowns you can measure, one team works on it, and releases are calmKeep one application and one database. Spend the effort on the product.

What each piece costs you to run

Every piece adds something to deploy, monitor, update and repair.

Each piece: what it solves, what it adds, and the signal you need it
PieceWhat problem it solvesWhat it adds to runSignal you need it
One application, one databaseGetting a working product in front of usersOne thing to deploy, back up and monitorThe starting point
ContainersThe app behaves differently on different machinesContainer images to build and keep up to dateSetup differences cause bugs, or your host runs containers
Caching and read replicasToo many reads for one databaseCopies that can lag behind, and cached data to refreshMeasured slow reads that query fixes did not cure
Orchestrator, such as KubernetesRunning many containers across many serversA cluster to run, plus logging, monitoring and alerting to chooseMany services on several servers, needing automatic restarts
MicroservicesTeams blocking each other, or parts that scale differentlyCalls between services, data kept consistent across them, more monitoringSeveral teams, or one part with clearly different load
ShardingData or writes beyond one serverRouting, rebalancing, backups and schema changes on every shardOne server is full even after the steps before it

Microservices. Microsoft's architecture guide is plain about the trade. It says a microservices application has more moving parts than the equivalent monolithic application. Because each service keeps its own data, consistency across services can be a challenge. The guide says success requires "a mature DevOps culture": the habits and tools to release and monitor software often.

Kubernetes. Its documentation says it provides a framework to run distributed systems resiliently: restarts, load balancing and controlled rollouts. It does not build your application or dictate logging, monitoring or alerting, so you choose and run those too. A cluster has a control plane and one or more worker nodes, and someone has to look after both.

Sharding. Microsoft's sharding pattern says it introduces substantial and permanent complexity into your data architecture, for the system's lifetime. Monitoring, backups and changes to the database's structure must then cover every shard.

The Monolith First essay on martinfowler.com makes a related point. It notes that "almost all the successful microservice stories have started with a monolith that got too big and was broken up".

Signs you have outgrown one app and one database

You have outgrown the simple setup when a measurement shows a limit that simpler fixes did not remove. These signs come from the sources' own descriptions of when each pattern fits; none of them is a number of users.

  • The database has hit a limit you can't scale past. Microsoft suggests sharding when the data outgrows one database and no larger server fixes it, or when the load exceeds what a single instance can sustain.
  • Writes, not reads, are the bottleneck. The same page says read replicas and caching can offload read traffic. Sharding is for when write load is also high.
  • One table has grown very large. PostgreSQL's guidance is that partitioning, splitting one large table into smaller pieces, is normally worthwhile only when a table would otherwise be very large. Its rule of thumb is a table bigger than the server's memory. Partitioning still runs inside one database.
  • Teams are getting in each other's way. Microsoft lists small, focused teams and independent releases as benefits of microservices. With one team, there is nobody to unblock.
  • One part needs to scale on its own. The same guide notes that services can be scaled independently. That helps only when one part's load differs clearly from the rest.

Microsoft also lists when sharding might not be suitable: when your data and throughput fit within a single database, even with projected growth. In our view, that describes most business apps today.

A common order to grow in

A common path is one step at a time, simplest first, measuring before each step. It is not a universal ladder. Consistency, availability and who will run each piece decide the order for your app.

An app that must stay up through a server failure may need a standby copy of the database for that reason alone. Data that must never be stale, such as stock levels or balances, may rule out some caching and replica reads. A piece nobody on your side can run is a risk, whatever its place in the list.

  1. MeasureFind out what is actually slow. In PostgreSQL, the EXPLAIN command shows how a query will run. The pg_stat_statements module, once switched on, tracks statistics for every query the server runs.
  2. Fix slow queries and add cachingFix what the measurement shows, such as a missing index or the same query repeated for every item in a list. Cache answers that are asked for often and change rarely.
  3. Move to a larger serverMicrosoft notes you can scale vertically, adding processing power, memory and disk, to postpone the limits of one server for a time.
  4. Add a read replicaA replica takes read-only queries off the main database. PostgreSQL's documentation says read-only database servers can be combined relatively easily, while servers that also write are much harder to combine.
  5. Split out one partIf one part has its own team or its own load, move only that part into a separate service. Keep the rest as one application.
  6. Shard lastShard only when the data or the writes are beyond one server after every step above. Partitioning a table within one database comes first, and needs no extra servers.

Infrastructure follows the same rule as scope: build for the users you have, and write down what waits.

If your app arrived with all of this already

Then the first question is what each piece is doing for you today. An app built quickly, sometimes with AI coding tools, can arrive with containers, an orchestrator and several services in place. That is not wrong in itself, but it means more to run.

A review answers this before anyone changes anything. Our guide on how to review an app built with AI coding tools covers what that review looks at. Whoever built it, make sure the code and accounts are in your company's name; what to do when your developer left lists them.

Questions to ask before you accept the architecture

Ask these of whoever proposes the setup, whether that is a freelancer, a development company or your own team. Good answers are specific and point to a measurement.

Bring this to the call

  • What problem does each piece solve for us today, and how was it measured?
  • What would break, or get slower, if we ran one application on one database instead?
  • Who will deploy, monitor and update each piece after launch, and what skills does that need?
  • What have we tried first: measuring, fixing queries, caching, a larger server?
  • If we add this later instead of now, what would the change involve?
  • Are the code, the hosting and every account in our company's name?

If you're still choosing what to build, read website, web app or mobile app. If a ready-made product might do, read off-the-shelf, low-code or custom software.

Next step: send us a short note on what the app does, who uses it, and the setup you were given or quoted. We reply within 24 hours, with a few questions or a time for a call.

Questions

Is a monolith bad practice?

No. It is the simpler setup to run, and the Monolith First essay notes that almost all successful microservice stories began as one.

Do I need Docker for a small app?

You don't need it, but it can help, because a container will work the same way in a data center or anywhere in the cloud. Unlike an orchestrator or microservices, it is easy to undo.

Do I need Kubernetes?

In our view, only when you run many containers across several servers and someone on your side can run a cluster. A host that restarts and scales the app for you may be all you need.

Can you take over an app that was built with microservices?

Often, after a review of the code and setup. We'll tell you if it's sound, fixable or better rebuilt.

How much does it cost to simplify or rebuild our setup?

It depends on what you need. Tell us about the project and we'll send a written quote with the scope, timeline and what's included. For larger or less defined work, Discovery & Scope comes first and ends in an estimate you own.

Sources

Reviewed and edited by Online Scope before publishing. Something out of date? Tell us at info@onlinescope.in. How we write the Blog.

Keep reading

Tell us what the app does, who uses it, and the setup you were given.

We reply within 24 hours.

What is it about? Optional, pick any