Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between a Module & Microservice

This abstract gave the difference between a Microservice and an API as:

A microservice exposes it's interface, what it can do, by means of an API. The API is the list of all endpoints that a microservice respond when it receives a command/query. The microservice contains the API and other internal+hidden things that it uses to respond to client's requests.

I've worked with Modules & Microservices in Java, but is there a better way to distinctively describe the differences between a Module & a Microservice?

Based on my experience several Modules were imported as part of a Microservice project. Is a Microservice a module of some kind with additional capabilities of exposing RESTful Endpoints? What distinctively differentiates a Module from a Microservice or vice-a-versa?

Is there more we can discuss about the topic in question to clarify the potential confusion?

I have added some visual aid for further clarity:

An example of a microservice that utilises various modules (Source: Author)

Please refute if you may, and also provide reliable references in relation to your experience with microservices and modules.

like image 426
S34N Avatar asked Nov 27 '18 10:11

S34N


2 Answers

The difference between a module and a microservice is one of packaging. Modules are programming level constructs which package and encapsulate a piece of software for reuse by other software via inclusion in a deployment (designed for in-process execution). A microservice is a deployment of a piece of software for use by other software, separated by a wire protocol.

like image 36
Rob Conklin Avatar answered Sep 19 '22 10:09

Rob Conklin


Microservices provides an API (REST or No Rest).

Microservice code could be written in a way that some bigger project could use it as a module.

When we choose it to be a microservice rather than module:

  1. We decouple it from the system which is using it
  2. This microservice can scale independently ie , use specific DB for its purpose
  3. Use whatever development language (suited best for its purpose) - if using it as module then this has to be written in the language in which majority of your code bases and modules are written
  4. Takes care of its data patch
like image 89
techagrammer Avatar answered Sep 22 '22 10:09

techagrammer