Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microservice architecture, what is a service in this case

I'm reading some documentation about the micro-services architecture (through this link for example) and I was wondering what is exactly a service in this case.

In IT, everything could be called a service: - a SPRING REST application launched through the java command like:

java -jar build/libs/gs-rest-service-0.1.0.jar

  • It could also be a classes corresponding to the business layer in a DDD
  • It could be simply something related to the domain studied, like providing something to somebody
  • and many others... (android background running services etc...)

But in microservices, what does it mean? And what kind of technologies / tools are used to create a "service running by himself" in the Java EE stack for example? It's only related to webservices?

like image 309
mfrachet Avatar asked Apr 12 '15 16:04

mfrachet


People also ask

What is a service in microservices?

With a microservices architecture, an application is built as independent components that run each application process as a service. These services communicate via a well-defined interface using lightweight APIs. Services are built for business capabilities and each service performs a single function.

What is a service vs microservice?

The main distinction between the two approaches comes down to scope. To put it simply, service-oriented architecture (SOA) has an enterprise scope, while the microservices architecture has an application scope. Many of the core principles of each approach become incompatible when you neglect this difference.

What is a service in software architecture?

In the contexts of software architecture, service-orientation and service-oriented architecture, the term service refers to a software functionality, or a set of software functionalities (such as the retrieval of specified information or the execution of a set of operations) with a purpose that different clients can ...


2 Answers

I would start with Your last question - It's only related to webservices? That's debatable. I would say, NO. It's related to webservice (but not only to it.)

Martin fowler describes microservices as a small subset of SOA, after all microservices are services, and SOA is a very generic and broad term.

Below are some of the important aspects of Microservices:

  1. Each service (or a set of few) should have it's own data store.
  2. Services are organized around the business needs or functionality.
  3. Each service is independent so they can be implemented in any language. Leads to polyglot programming culture in team.
  4. Service can take request from client or from other services as well.
  5. They are usually event driven and asynchronous so scaling becomes easier.
  6. Services are dumb as they only do one thing (but they should be self sufficient to monitor themselves)
  7. They can be helpful in continuous deployment or delivery as implement to deploy cycle is really small.
  8. They are very small so there is not much of network overhead in deploying them. So they can be deployed across a cluster of nodes in few minutes.

    Also, I want to stress that, above are NOT only true about microservices. Companies like google, netflix, and Amazon have been doing similar thing even before the term was coined.

like image 169
rai.skumar Avatar answered Oct 16 '22 13:10

rai.skumar


Exactly, that's the beauty of microservices model! You can start thinking about microservices when you design your maven multi-module project, for example. Low coupling, clear separation of concerns, may be even asynchronous communication. When you feel more confident you extract them in into apps and run in a one host, next step - run in different hosts. It's up to you to decide how exactly they should be deployed, it's related to goals you want to achieve (fault-tolerance vs low latency, etc.) and DevOps resources you have (because more separation you have more maintenance you need).

Regarding Java EE stack - nothing specific, just usual jar or war file running using java -jar or application servers like Tomcat.

Another direction is to use tools like Docker + CoreOs / kubernetes / ..., Mesos + Marathon, etc., but they are suitable for any languages / frameworks in microservices.

Edit:

Microservices can use a combination of synchronous (REST, SOAP) and asynchronous protocols (messaging queues like ActiveMQ, RabbitMQ, etc). It's up to you to decide how to combine them. My example: labs.bench.co/2014/12/10/microservices-at-bench-intro

like image 40
sap1ens Avatar answered Oct 16 '22 12:10

sap1ens