5 ms·
I think that microservices are just a deployment model of the service boundary and there should not be really a distinction between whether something is deploye
by alexk 8y ago
I think that microservices are just a deployment model of the service boundary and there should not be really a distinction between whether something is deployed as a microservice or a monolith, because application should support both for the scenarios when it makes sense.
Consider the following API:
UsersService:
CreateUser
GetUser
AppCatalog:
GetApp
CreateApp
What if AppCatalog and UsersService implement both local version of the interface and GRPC one? Then the distinction whether it's a microservice vs a monolith goes away, it becomes a matter of whether they are deployed in a single linux process or across boundaries of processes/servers.
I have implemented this technique in teleport:
https://github.com/gravitational/teleport/tree/master/lib/services https://github.com/gravitational/teleport/tree/master/lib/se...
Integration test suite is run against RPC version and local version at the same time to make sure the contract remains the same:
https://github.com/gravitational/teleport/blob/master/lib/services/suite/suite.go https://github.com/gravitational/teleport/blob/master/lib/se...
A single teleport binary can be deployed on one server with all microservices, or multiple cluster scenarios.
where the binary is simply instantiated with different roles:
auth_service:
enabled: yes
node_service:
enabled: no
Is Teleport a monolith? Yes! Is it a micro-service app? Yes! I'm so happy that we don't have to think about this split any more.
- qaq 8y agoThe question is transaction boundaries try unrolling a change that had to touch state of several services and one of the requests failed
- alexk 8y agoRight, because we write against DynamoDB/Etcd transactions were a non-option anyways, and we only have CompareAndSwap as a locking primitive https://github.com/gravitational/teleport/blob/master/lib/backend/backend.go#L46 https://github.com/gravitational/teleport/blob/master/lib/ba... In addition to that Golang's context https://golang.org/pkg/context/ https://golang.org/pkg/context/ is used to broadcast the failure of a distributed operation and release associated resources with it
- Thaxll 8y agoDynamoDB has transactions now. https://aws.amazon.com/blogs/aws/new-amazon-dynamodb-transactions/ https://aws.amazon.com/blogs/aws/new-amazon-dynamodb-transac...
- alexk 8y agoIt's probably closer to multi-writes though, than transactions in a classic sense, but good improvement nevertheless.
- Thaxll 8y agoIt's a real transaction like MySQL or PG. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html https://docs.aws.amazon.com/amazondynamodb/latest/developerg...
- AmrMostafa 8y agoI don’t think it is ok to try and make service boundaries transparent and swappable. A service speaking to another service has to know the cost and overhead of the call it is making as otherwise it can’t provide an efficient interface