• Definition

  • Benefits

  • Usage - Examples

  • Best Practices

Microservices

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

The usage of Microservices has increased a lot and are already used worldwide, from most developers nowadays.

The scope, is to develop a complete Application by combining together “small” services. Each service is executed separately and the whole communication, is mostly done through lightweight protocols.
 

Therefore, one should think of Microservices, as a kind of “service” oriented architecture. Microservices are already supported by various programming languages and different platforms. Through these “simple” and standalone pieces of software, large scaled applications can be built and maintained, in a more flexible and more stable operational manner.
 

  • You do not need to coordinate and organize large teams, but smaller and more flexible group of developers.

  • The goal for each Microservice is to be developed and serve exactly the purpose it was meant for, regarding the business requirements.

  • Each Microservice can also interact with another one and also have its own unique URLs
     

Benefits

Microservices are small pieces of applications created from development teams. Each Microservice, is executed separately without any direct dependence on other applications (other Microservices).

 

  1. A Microservice can be changed, upgraded or updated independently, that is without having to rebuild or re-compile the whole application from the start. This way, errors and consequences on other modules or functionality can be better controlled and minimized.

  2. They can be written on different programming languages, which contributes, to smaller development circles and lower costs.

  3. The whole application architecture is being improved, regarding scalability and expandability.

 

Usage - Examples

Below you will find a list of some Microservices - Frameworks, that currently exist in the Market. Some of them are free to use, while for others, you may have to pay for the respective Licenses. Depending on your Project, you can choose which one would be the most appropriate for you.

elow you will find a list of some Microservices - Frameworks, that currently exist in the Market. Some of them are free to use, while for others, you may have to pay for the respective Licenses. Depending on your Project, you can choose which one would be the most appropriate for you.

  • Restlet

  • Spark Framework

  • Dropwizard

  • Ninja Web Framework

  • Jersey

  • Play Framework

  • Spring Boot

  • Swagger

Simple Code examples

Below are some code examples from different programming languages, for a service with a simple HTTP server exposing one single endpoint.

Python

from flask import Flask 
app = Flask(__name__)
@app.route("/greet")
def greet():
    return {"message": "Hello from Python!"}
if name == "__main__":
    app.run(port=5000)

Node.js

const express = require('express');
const app = express();

app.get('/greet', (req, res) => {
    res.json({ message: 'Hello from Node.js!' });
});

app.listen(5001, () => {
    console.log('Node.js service running on port 5001');
});

Java Spring Boot

const express = require('express');
const app = express();

app.get('/greet', (req, res) => {
    res.json({ message: 'Hello from Node.js!' });
});

ap400pxp.listen(5001, () => {
    console.log('Node.js service running on port 5001');
});

Best Practices

  • Regarding data store, each Microservice should use its own data store that is most appropriate for their target development.

  • Another best practice, is to develope Microservices in containers. This would enhance and make the deployment process easier and more dynamic.

  • In a few words, Miroservices are the future of independent, flexible and cost saving application development.

Useful Links

Below, some additional Links regarding Microservices examples and their usage:

Views: 5