• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

The Tao of Microservices: Defining Microservices

 
Ranch Hand
Posts: 92
Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking at Chapter 2, I love that you mention that we are working in real life - in a messy world of grown-ups.  I the "conventional" definitions that you provide on:

1) self-contained (100 lines of code max)
2) independent deployable processing communicating asychronously
3) Microservices are mini web servers offering a small REST-based HTTP API that accepts and returns JSON documents.
4) A micro-service is an independent software component that takes no more than one iteration to build and deploy

if I rank them in importance it would probably be in my mind 2, 3, 4, 1 - and in fact the 100 lines of code is kind of off-putting to me, but maybe I need to change my thoughts on that. Given the need for "independence" that may require its own data-store, if we keep microservices so small, might we end up needing too many resources on the data storage side?  Also, what can we learn from the world of Service Oriented Architecture (SOA) that we can use as lessons learned when writing microservices?

Thanks
David Sachdev

 
Author
Posts: 44
7
MyEclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way I read it was that "100 lines of code" was another way of classifying what would qualify as microservices. I find it strange for the matter that I wonder what business level functionality can we achieve there ?
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Regarding #2 and Security... In the "old way" of doing things, we had a monolith where you could authenticate/authorize once and you'd be able to do whatever your level of authentication/authorization allowed you to do.
With microservices, I'm curious as to best practices concerning security. Do you have a token (OAuth or otherwise) that follows the flow from microserviceA to mSB to mSC, etc.? Do you set up logins (or some other auth mechanism) for each service
and ask users to provide auth info for every microservice? This is a real issue we're having in our company.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to add that it's surely independently deployable but it's also independently scalable (really important as MS can be used to solve performance issue in a classical SOA)! I don't think that the size or number of lines of code matters but it implements one feature and it's the only element who has the right to update and persist an element.

Therefore you're not obligated to keep them too small, it has to deserve a purpose, it can also have shared resources with other MS (shared code), and more you should not microservice everything necessary. It's good to use Microservices on the critical part of the application. The one who need to be changed often and where you think that the most time will be spend into them.

For example if you take a classic SOA a good approach would be to migrate only the critical parts into MS. And even MS Architecture is an SOA Architecture (not a classical one, but it's one). You can have a classical SOA, a Domain Driver SOA or a MS SOA. But for me they are all SOA's... They just have different purpose and solve different problems. But MS Architecture could have been set up since REST was invented... It just it wasn't making any sense to have 100 Applications servers. It just became trendy because of the development of IaaS and PaaS solution.

But that's my point of view and I'm probably partially wrong.






 
David Sachdev
Ranch Hand
Posts: 92
Mac Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Nell Frédéric wrote:

For example if you take a classic SOA a good approach would be to migrate only the critical parts into MS. And even MS Architecture is an SOA Architecture (not a classical one, but it's one). You can have a classical SOA, a Domain Driver SOA or a MS SOA. But for me they are all SOA's... They just have different purpose and solve different problems. But MS Architecture could have been set up since REST was invented... It just it wasn't making any sense to have 100 Applications servers. It just became trendy because of the development of IaaS and PaaS solution.

But that's my point of view and I'm probably partially wrong.




That also brings up another question - does MicroServices and Containerization go hand-in-hand, or is it just that it is the preferred methodology to allow for many services, but without over-use of resources.  I know we can run multiple servers on a single machine, but containerization is much easier.

So curious, in this new world, do you run Docker on your local machine, dev version of OpenShift, something else?  Also what new tools are in your toolbox in the micro-services world?

Thanks
David Sachdev
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was recently reading a book which stated that defining a micro service by number of lines of code may not be ideal.
Rather the book said that it is usually better to define a micro service by what it covers and it should only cover one aspect.

For instance if the service updates a database with a file name and allow for file uploading then it's a micro service. This could be treated as one aspect.
However if you want to add commenting of those uploaded files then the commenting should be it's own micro service and treated as it's own aspect.

I know that I'm not an expert so this one aspect thing may not be correct.
Many people do seem to have their own definition for what a micro service is and I do not know which who to correct.
 
Author
Posts: 31
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I’ll comment on SOA first. If we do not learn from history then we are condemned to repeat it.

SOA is microservices, but in those days deployment was much harder

Everybody doing microservices should read https://www.manning.com/books/soa-patterns - this is the book! I learned a lot of stuff from it. It’s a heavy and serious reference work that I still use.
 
Richard Rodger
Author
Posts: 31
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I only provide “definitions” to tear them down.

It’s like asking for a definition of general relativity. You get fluff. You should maybe put in the time to grok linear algebra and differential calculus if you want to do anything useful.

How does a definition help you? Are you going to suddenly be able to build large scale microservices applications on the back of a sentence or two? I feel we need to acknowledge the complexity and lean into it.

I did give a talk a few years back and took the “100 lines” position - and was rightly embarrassed by intelligent audience questions.

So I wouldn’t seek a rigorous definition, or indeed hold your teams to one. Better to think hard about what is needed, and possible, in your own contexts.

 
Nell Frédéric
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@David Sachdev:

That also brings up another question - does MicroServices and Containerization go hand-in-hand, or is it just that it is the preferred methodology to allow for many services, but without over-use of resources. I know we can run multiple servers on a single machine, but containerization is much easier.



I think that containerization made MicroServices architectures viable and respond to some constraints that was not possible before. (auto-scaling, infinite allocation of resources => Pokemon Go as good example)


So curious, in this new world, do you run Docker on your local machine, dev version of OpenShift, something else?  Also what new tools are in your toolbox in the micro-services world?



I would do some local Testing with JUnit and SOAPUI to mock my services and with the help of some other test framework like Spring Test Context maybe.

Then yes Openshift is one of the main PaaS and it's open-source and working really good. (I used it in one of our project and it was a pleasure to work with) But I won't use a local dev version, the dev would be an openshift environment (project) where I can directly test my changes in an integrated prod-like environment.  I would recommand to use a PaaS solution in order to have already a build-in solution for persisting Logs, sharing configuration, abstracting the containers and managing the internal networks.

Developing a project with a PaaS like openshift differ of developing a project with Docker and Docker compose. Therefore the use of docker locally doesn't make too much sense beside for testing the build of your image locally before to commit some change in your dockerfile. But Openshift as a build in process that automatically detect the type of building tool he need to use to compile your code and create the image for you automatically without any needs of a docker file. (for example he see that the type for file is a pom.xml and that it generate a WAR file so it's going to automatically check out a docker image with a web server that can host WAR files, with the same Java version as the one you use in your project, build your apps with maven and create an image with your war file running in a web-server) So it would even not be necessary to use docker locally. Just develop, Unit test, mock test and commit.

Then there's also a really interesting tool that allow you to develop MS really fast. It's called JHipster. I can be a good alternative to spare a lot of recurrent work.



 
reply
    Bookmark Topic Watch Topic
  • New Topic