Monolithic architecture implies that all functionalities of the application are assembled in a single codebase that is developed and deployed together.
Service-Oriented Architecture (SOA), and in particular microservices, is an approach where the application consists of a set of modules that interact through well-defined interfaces (usually networked).
When monolithic is advantageous:
When SOA is advantageous:
Example comparison: Monolithic:
public class Application { public static void main(String[] args){ UserService userService = new UserService(); OrderService orderService = new OrderService(); // Order and user logic — everything in one application } }
SOA — interaction via API:
GET /user/42 # request to user service GET /order/532 # request to order service
Key features:
Does SOA share a database between services?
Typically, services share data for weak coupling. Shared databases are acceptable during migration phases, but ideally each service has its separate database.
Is monolithic always worse in performance?
No, a monolith can be more performant at smaller scales, as there are no unnecessary network calls and memory separation.
Can a monolith be converted to microservices "all at once"?
No, typically the transition is made in phases, starting with defining context boundaries and transforming them into services.