Urgent.News

What's breaking now, across thousands of outlets.

Tech

Everything You Need to Know About Microservices

Everything You Need to Know About Microservices Microservices are one of the most discussed architecture styles in software, and one of the most misunderstood. Some teams adopt them and get faster, independent releases. Others adopt them and end up with a distributed mess that is harder to change than the monolith they replaced. The difference is rarely the technology. It is whether the team…

Microservices are a popular architecture style in software development, though they remain widely misunderstood. Adopting microservices can lead to faster, independent releases for some teams, while others may end up with a complex, difficult-to-manage distributed system instead. The key to success lies in understanding what microservices trade away.

This article delves into what microservices are, why teams choose them, their costs, design principles, and how to tell if they are the right fit for your situation. It also highlights how TDK CLI aids in running microservice systems on your own machine during development.

A microservice is a small, independently deployable service that owns one specific business capability. It includes its own code, data store (ideally), and network interface for other services to call. This style is characterized by three properties: independent deployment, single responsibility by business capability, and decentralized data ownership.

The term "micro" is misleading; the goal is not to create the smallest possible service, but rather a service that one team can understand, change, and operate without coordination with everyone else.

Monoliths are a single deployable unit with all modules sharing a process, codebase, and usually a database. They are the default choice for many reasons: fast function calls, simple transactions, straightforward debugging, and a single thing to deploy. Microservices, on the other hand, trade these advantages for independence. The trade-off includes independent deployment, single responsibility by business capability, and decentralized data ownership.

Monoliths have advantages like fast function calls, simple transactions, straightforward debugging, and a single deployment artifact. Microservices, however, offer independent scaling, better technology fit, fault isolation, and faster, safer releases. However, microservices come with their own set of costs. Teams that overlook these costs regret the move.

Network unreliability is a significant issue, as every call between services can time out, fail, or succeed on one server while the client sees an error. This necessitates retries, timeouts, idempotency, and circuit breakers. Data consistency is also more challenging, as a single business operation may span several services, requiring eventual consistency, sagas, or careful design.

Observability is mandatory, as without distributed tracing, correlated logs, and per-service metrics, a single failed request can become a search across ten log streams. Operational overhead increases as each service needs its own build, deploy, configuration, secrets, dashboards, alerts, and owner. Local development becomes harder, requiring the ability to run the entire system on a laptop.

Versioning and contracts are crucial, as changing an API now affects every consumer. Compatibility rules, schema validation, and deprecation paths are necessary. Testing also shifts, with unit tests still important, but end-to-end tests across services becoming slow and fragile. Contract tests and well-scoped integration tests are more critical.

Design principles include splitting by business capability, starting from the domain rather than technology, and identifying useful boundaries from the language your business already uses. Domain-driven design speaks to these as bounded contexts, areas where a term has a consistent meaning. A warning sign is if every feature request touches four services, indicating that your boundaries may be incorrect.

Each service should own its data, exposing it only through its API, as sharing a database between services couples their schemas, deployments, and failure modes. APIs should be treated as contracts, versioned explicitly, backward compatible where possible, and validated with payloads and documentation. Prefer asynchronous communication when appropriate, while synchronous calls fit request-response work.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

How to see which companies are hiring right now (and what changed this week) from Greenhouse, Lever, Ashby and Workday boards

A company's open roles hint at where its money is going next. If it adds five enterprise Account Executives in Germany, it probably plans to sell harder there.

  • Job boards provide insights into company hiring trends
  • Public JSON data from Greenhouse, Lever, Ashby, Workday can be accessed directly
  • Python script compares job listings from last week to current data

Nike's longest-running Meta ads don't sell shoes. They sell the Nike App

Here's a number I didn't expect: 38 of 150 active Nike ads on Meta use the "Install now" button. Not "Shop now", not "Learn more". Install.

  • 38 out of 150 Nike ads on Meta use "Install now" button instead of "Shop now" or "Learn more"
  • Three longest-running ads (560, 542, and 390 days) are app-install ads

28 Free Browser-Based Writing & Editing Tools for Developers and Content Creators

Developers write more than we admit: READMEs, docs, commit messages, release notes, blog posts, emails to stakeholders. Good writing tools help, but most want an account or upload your draft to a…

  • 28 free browser-based writing tools aid developers in creating various documents.
  • Speech synthesis engine reads text aloud with adjustable speech rates, pitch, and volume.
  • Dictate directly into live transcript with 20 language support and editing capabilities.

More from Sunday 18 October →