3 ms·
> The one hot backend paradigm that is easiest to scale is to write stateless, containerized microservices. Functional programming will nudge you in the right d
by lmm 7y ago
> The one hot backend paradigm that is easiest to scale is to write stateless, containerized microservices. Functional programming will nudge you in the right direction of writing stateless code but isn't strictly necessary.
Microservices force you to reduce your service interfaces to lowest common denominator. You simply can't build a really powerful system out of microservices with a reasonable amount of code, because there's no way to send complex structures across service boundaries; you end up spending more effort serializing and deserializing than actually doing business logic.
Functional programming lets you achieve the same isolation benefits as microservices without the overhead.
- opportune 7y agoA good microservice architecture won't have an external call result in multiple serde bounces between other microservices before a response is returned. At worst it should wrap access to something slow like a database or another complicated backend service. >Functional programming lets you achieve the same isolation benefits as microservices without the overhead. Isolation benefits, sure. Performance benefits, no, because you still run into https://en.wikipedia.org/wiki/Amdahl%27s_law https://en.wikipedia.org/wiki/Amdahl%27s_law
- weberc2 7y agoWhy should serialization and deserialization be “effort”? Your data objects shouldn’t be more complex than is trivially represented with JSON or else you have a different problem. Besides, while I’m not a microservices enthusiast, isolation isn’t the main goal of microservices, it’s being able to deploy, scale, and operate services independently from other teams.
- lmm 7y ago> Your data objects shouldn’t be more complex than is trivially represented with JSON or else you have a different problem. That's the whole problem I'm talking about. Like I said, it forces you to reduce all these interfaces to lowest common denominator. > Besides, while I’m not a microservices enthusiast, isolation isn’t the main goal of microservices, it’s being able to deploy, scale, and operate services independently from other teams. If you're just talking about each team having its own service, that's not what's usually meant by "microservices".
- weberc2 7y ago> That's the whole problem I'm talking about. Like I said, it forces you to reduce all these interfaces to lowest common denominator. I don’t know what you mean by “lowest common denominator” or how “being forced to write good code” is inherently bad. There are lots of efficiencies to writing good code (easy to test, reuse, refactor, etc), not just writing microservices. > If you're just talking about each team having its own service, that's not what's usually meant by "microservices". That may not be the definition but it’s the principally cited advantage.
- marcinzm 7y ago>because there's no way to send complex structures across service boundaries; you end up spending more effort serializing and deserializing than actually doing business logic. Honest question, have you ever actually worked with decently written micro-services? You don't send complicated objects, you send relatively simple objects. And you don't do it by hand, grpc and thrift have existed for a long time. I'd argue that part of good decoupling, in functional or micro-services programming, is making sure you only communicate simple objects around.
- lmm 7y ago> Honest question, have you ever actually worked with decently written micro-services? As decently as is possible, yes. > You don't send complicated objects, you send relatively simple objects. Right, which limits how powerful the overall system you can build is. That was my whole point. > And you don't do it by hand, grpc and thrift have existed for a long time. Sure, but they have pretty anaemic type systems and a lot of stuff is just inherently high-effort to serialize (see the recent post about defunctionalising the continuation). > I'd argue that part of good decoupling, in functional or micro-services programming, is making sure you only communicate simple objects around. Functional programming gives you more tools to interleave complicated constructions while still enforcing that all your concerns are treated orthogonally. For example you can form a free monad structure that contains commands that will be interpreted by one particular service, but interleaved with other computations that will be implemented by other services or directly. The types ensure that everything's properly decoupled, but you can still represent all the complexity that's there in the actual problem. You can't do that with microservices.