Lately many people has been asked me how they could begin with microservices, what they need to learn, what they have to do.
To help answer these questions (and also to help on organizing and prioritizing things), I made this small guide.
The tools mentioned here are not necessarily in order of importance or any other order at all.
Docker
No matter which server did you choose, I’d highly recommend to deploy your application using Docker. Why?
- Isolation: It’s easier to isolate your microservices from each other. You could deploy one microservice per container;
- More options: You can mix many application servers and/or services in the same environment. Only thing you need to do is to run another container with the service you need. I’ve wrote an article called “Modular and Reusable Java EE Architecture with Docker” with Bruno Souza and André Carvalho where we explored it in more details;
- Clustering: Of course, you can build a cluster without containers. But it’s easier with them! You can easily manage the amount of nodes for each microservice with a couple of command lines. If you mess somethings, just remove the container and run it again. You can even work with some orchestration and add elastic features to your architecture;
- Deploying: Deploy your application by deploying your container (called “appliance”). Lot of portability and will also help the Ops guys! See more at Step-by-Step High Availability with Docker and Java EE.
Payara Micro
Although you can use any Java EE compatible server to do it, Payara Micro will give you a much more “ready” environment.
It’s small (< 70MB) and has automatic and elastic clustering. It’s ready for the cloud and for containers. And it has also some cool ready-to-use integrations that will bring more power to your service without overload them.
Check it out: https://www.payara.fish/payara_micro
Oh… of course, they have a pre-built Docker image available at Docker Hub… 😉
The API’s supported are:
- Servlets, JSTL, EL and JSPs
- WebSockets
- JSF
- JAX-RS
- EJB lite
- JTA
- JPA
- Bean Validation
- CDI
- Interceptors
- JBatch
- Concurrency
- JCache
Microprofile Initiative (community for the win!)
If we will learn something, why not learn together? I’m an all about community person…
Eclipse Microprofile (http://microprofile.io) is a initiative that joins many vendors, communities and individuals around this hot topic. The target is to discuss and create proper standardization for microservice architecture.
You can join as collaborator (see the list at the site) or just watch the mail list and see what is going on. It’s a great and not so common opportunity to help on defining the future of something really big.
A Mature CI/CD Process
If you have problems with building/deploying one single WAR, guess what will happen with dozens? Hundreds? Thousands?
Once you multiply independent services and distributions, you also multiply all the problems they bring with them (environment, setup, security, etc).
So if you are wondering if you should break down your monolith, first automate its lifecycle.
Once you are deploying a few artifacts using any level of automation you can evolve it to a more complex scenarios. And then when you reach microservices you will be more comfortable and less susceptible to a painful build, test and deployment processes.
So are you already using microservices? Did you migrate some monolith to this new architecture model? Leave your comments and experiences bellow.