Live data from Hacker News

Microservices are hard

code-held.com

221–230 of 356 posts

Re: Microservices are hard

#221
I think the key point in the article is the conclusion: try building things more as modules that can be easily split off into separately running server applications as needed later.

So in practice that could look like the interface to your "module" should use parameter objects [1] for function calls, and build in the assumption that most information retrieval or processing requests are async. Then when the time comes swap out the local version of the module of the client stub version.

To avoid manually writing the serialization, those parameter objects should have been code generated already. Although the goals of something like tRPC [2] are admirable, having to manually check inputs with typeof [3] honestly shouldn't be necessary. And allowing non-nullable fields may make field deprecation extremely difficult or impossible. Guess what? If you have any native mobile clients they may not upgrade for years! OpenAPI also exists, but seems a bit too verbose to read, or author manually.

So what would I suggest? Just use proto3/gRPC [4]. It defines the JSON encoding if you haven't clients that can't talk native Protobuf, or don't want to have bikeshedding over what type-casing to use for JSON serialization. If your cloud provider doesn't do it for you already, just drop an Envoy with the gRPC-JSON transcoder in front [5]. If you can't prove you'd have an actual performance problem due to gRPC/Protobuf, then it probably isn't worth the effort to use a less battle-tested messaging library.

So back to the main topic... it doesn't have to be hard to do microservices when the time comes, just make sure your codebase is easier to convert.

[1] https://wiki.c2.com/?ParameterObject

[2] https://trpc.io/

[3] https://trpc.io/docs/quickstart#add-a-mutation-procedure

[4] https://developers.google.com/protocol-buffers/docs/proto3#j...

[5] https://www.envoyproxy.io/docs/envoy/latest/configuration/ht...

Re: Microservices are hard

#222
The discussion of Microservices vs. Monolith feels a lot like NoSQL vs. Relational one. That is to say, Microservices are a bad idea right up to the point where monoliths won't work.

Most services can be successfully implemented with monoliths (and relational DBs for that matter). Only when that solution doesn't scale anymore, that's when microservices come in handy. Particularly when a large service has core functionality that must always run and secondary functionality that can tolerate higher rates of failure.

Re: Microservices are hard

#223

Earlier quoted context omitted.

> where user account information is copied to every single microservice's internal DB... to minimize access time to that information... In terms of access time, what does that gain you over a bog standard shared database? With careful planning, you can likely achieve the lowest access times using a shared database. There is so much more room for optimization at every level. The reason actual microservices (teams only…

You're not allowed to have a share DB with microservice architecture. Every microservice is completely self contained... The architecture of my organization was created by ardent microservice advocates, that took the definition of a microservice and treated it like a bible. Based on the conversations I had here, there are still people that treat microservices as sacrosanct. The more I work with microservices, the mor…

> You're not allowed to have a share DB with microservice architecture.

The law won't prevent you, but indeed it is impractical. As I said before, things like schema upgrades become impossible if you don't have the ear of other teams. When you can't call up another team you also lack trust, so security becomes an issue as well. This is why teams who operate in independent silos must ultimately have their own databases.

The practice has nothing to do with performance, though. Microservices has little to do with technology at all. It is about people.

> The more I work with microservices, the more I'm convinced that microservice first architecture is garbage.

I personally steer clear of organizations so large that they need to silo their teams internally, but I have had a positive experience using services provided by other companies with the only communication between us being API contracts. The concept works well enough. At least so long as the product does what you need of it.

If you try to force big business practices into a small organization, you're no doubt in for a bad time. That said, I don't get the impression you are talking about microservices at all, just a bad case of over-engineering.

Re: Microservices are hard

#224
post #158

I really do not understand the debate on monoliths and microservice anymore. Context matters so much. Should you have absolutely everything in 1 system. No. And I think no one thinks that anymore. Should you spilt your system into as many pieces as possible? No, of course not. You are prop. storing files one place and have a data in a database another place. And most likely none are on the webserver receiving request…

Agreed. I would add an extra thought around "Try to go monolith until things really breakdown" but you get at that in so far as the point where things breakdown is where either:

a) engineers are afraid of or find making changes difficult b) uptime issues result in heavy endpoints/services taking down others

To your point, microservices should be introduced expressly to solve those two problems, and not before.

Re: Microservices are hard

#225
post #216

Earlier quoted context omitted.

An important part of programming as a discipline is coming up with things that work regardless of context.

Could you give some non trivial examples of architectures or techniques in software engineering that work regardless of the context?

good naming

Maybe that is not "architecture" or "technique" but is is definitely not trivial and is important in almost any context -- but also probably not what you were going for.

Re: Microservices are hard

#226

Earlier quoted context omitted.

Are you, perhaps, not familiar with Conway's Law?

Considering that you've been engaging in strawman arguments this whole thread, I bow out of this discussion.

It is always curious when someone writes that they are bowing out of a discussion, as if they don't realize that no longer replying conveys the exact same information. Was there an additional takeaway here that I missed?

Re: Microservices are hard

#227

Don’t you find it weird that everybody else is either over or underengineering, but you , you engineer things exactly the right amount? I bet when you’re driving, you also tend to notice that everyone else is either an idiot driving way too slow in the middle lane or a maniac speeding past you. Nobody else drives as well as you do. It must be exhausting for these people to live in a world surrounded by strawmen, whil…

Yeah, it's crazy the hate microservices get. I happen to work on a product that needs to scale to handle millions of transactions distributed all over the world and the cloud microservice system is just flawless for this purpose. Is it harder to debug than a monolith? Sure. You need a team that has a good understanding about distributed systems (most coworkers have degrees and the ones without are really good at self…

The "hate" is directly proportional to the failure of microservice zealots to deliver on the ultimate, everlasting, universal prosperity and harmony, that they promised.

Re: Microservices are hard

#229
I am so, so tired of the "is hard" cliche. It's at gag response level for me. Am I the only one?

Writing meaningful titles is hard.

Re: Microservices are hard

#230
post #165
post #158

I really do not understand the debate on monoliths and microservice anymore. Context matters so much. Should you have absolutely everything in 1 system. No. And I think no one thinks that anymore. Should you spilt your system into as many pieces as possible? No, of course not. You are prop. storing files one place and have a data in a database another place. And most likely none are on the webserver receiving request…

Like any other well reasoned, balanced and pragmatic POV, the problem with your boring approach is you can’t wrap it in a clickbaitable blog and no flame war can emerge from it.

In no public debate do you get the participation of people who think everyone involved is a lunatic. We presume there are two extremes in any decision making process and ignore the third option, no matter how reasonable.
Post reply on HN