Show HN: Example of a polyglot microservice app
github.com
github.com
* It does not work (bug in node Dockerfile) * It requires extra builds (while users expect `docker-compose up` to _just work_) * There's no tester container to curl something to ensure me it works * The docker files are half baked - ex. not using layers correctly (npm install called after code COPY), ex. `npm build` redundantly called, ex. using ubuntu:latest rather than golang:onbuild... and so on.
And yes, I guess I could fix all that... submit a PR, and be declared the king of HN. But today I rather just complain.
… although using an onbuild image here wouldn't hurt
To me, the main benefit of the polyglot SOA paradigm is: we simply just can't find enough talent located in y skilled in x.
Most services complain of complexity from "the monolith" but upon further inspection, what we're usually see is poor architectural layout. These teams feel that microservices solve this, but really just make the entire backend more complicated.
The same can usually be achieved through enforcement of an API contract and good leadership rather then TLS handshakes.
I'll start off by saying that I agree with you in that when it comes to small teams, microservices is probably not the best option, as it adds additional unnecessary complexity.
But one of the best benefits I saw of microservices was that it allows small teams to work together mostly independently. It meant that each group could run in whatever way was best for the four of five folks in the group.
If the auth group really thought Go was the best solution for their problem, then they could do that. If the API team wanted to do a deployment every two weeks on Wednesday, they could do that. If the tools team wanted to deploy on every checkin, they could do that.
It meant that the 1000 engineers didn't have to all agree on a particular language, development method, or development cadence. Each team could do whatever worked best for that team, and was most in control of their own success or failure.
All you do, as a team of 5, is write nice modular composable well tested code. That way your code base will adapt as you grow. It's quite likely going from 5 to 1000 people is going to involve a number of large architectural shifts during the life of the product.
Different communication coordination patterns and levels of complexity.
Look at specifics to determine appropriate solutions (which will still have particular benefits and drawbacks).
I agree with this, but there's another very important driver for microservices - the presence of multiple customers, each with different ideas as to what makes up the right stack - i.e. SaaS.
In our domain (HR software) microservices make good sense because they allow each customer to compose their own stack, with individual bits coming from us or from third party vendors.
Without this need, I don't think I'd recommend most normal scale companies (Netflix et al excluded obviously) go microservices.
Here is the agressive part: People who can't see that shouldn't be software developers.
I was a bit agressive here because too much unnecessary complexity is probably the mistake I hate the most.
That's perfectly reasonable. Three imperative garbage-collected languages, two statically-typed, one dynamically-typed. That's easy enough to understand.
You would also likely need to be proficient with a shell and OS, and with all four toolchains.
Really, there is still only one backend (the shell), and one frontend (the browser). There is some overhead from using four separate runtimes, but that isn't a serious issue.
The greatest difficulty is communicating between each part and the OS/shell or each other. From what I can tell, this does the latter, each part communicating over a TCP socket.
The first: Java-all-the-things. The second: Anything goes! But it has to be 50 lines, or fit on one screen, or some similar metric of grokkability.
I've spent quite some time exploring the caverns of XACML (eXtensible Access Control Markup Language), even going so far as writing a limited implementation of it in JavaScript. It's infinitely flexible, extremely capable, horrendously complex, and just about the least fun standard to work with. Sure as heck gets the job done though. Just get yourself used to writing and debugging XML and you'll be fine.
I've also looked in great detail at Amazon's IAM policies. These are significantly simpler, and heavily inspired my current favourite library, ladon [1]. I recently wrote a GraphQL API and I found that GraphQL mutations and field accesses mapped nicely to policies in ladon.
One thing I found confusing: I expected that the Dockerfile in https://github.com/elgris/microservice-app-example/tree/mast... would automatically compile and build the Go application, but it looks like that's a manual step at the moment?
Just think about user creation. After a user is created, a common thing is to send a welcome email. Then you probably need to build an email service because you probably want to mail other times as well.
But if an email fails to be sent because there is an error in the service, you need to build around that and report it somewhere. You would probably make some kind of class or library that makes these requests to other microservices and now you're already on a path to hell because then that library is in language x and cannot easily be ported to another service etc.
Polyglot microservices is a shitty idea. It makes a hell for developers, a hell for maintenance and it doesn't give the end user any more value.
I am not really a fan of microservices as a concept in general, but polyglot microservices, seriously who would want to do that?