r/developersIndia • • Jan 30 '24
General Let's talk about Microservice architecture and communication between the services.
Microservice is the most opted architecture when your product has a lots of features that need to run independently and decoupled from each other. One important aspect is the inter-service communication. This discussion will basically look into the following comms types:
- EDA - event drive archittecture
- Message bus based
- gRPC
- Apache thrift
Do you guys use the above or something else?
71
Upvotes
•
u/AutoModerator Jan 30 '24
Recent Announcements
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
9
u/skywalker5014 Jan 30 '24 edited Jan 30 '24
according to my understanding:
- if you have like service B whose input is the output from service A and service A doesnt have to wait for the service B or be dependent on it for B's operation, like they can work parallely, then use message queues.
examples like an electronics sensor data capturing and processing service (service A) and a event logging service (service B) here A processes the input data and give output, this output will be passed to B for organizing in logs for future reference
- if service A and service B need to constantly communicate or exchange data with each other on a fast pace and depend on each other, then use remote procedure calls or wesockets such stuffs.
example is authentication service (service A) for each reqeusts from clients and the actual request processing service (service B)
I only have practical expereince in gRPC on a personal project, I havent used any mq brokers like kafka but i do know ther working thats it.
27
u/[deleted] Jan 30 '24
I know about Kafka and gRPC and have built some personal projects, but still can't really figure out when to use what since both are quite fast, except for a defined format for message, would love to hear more on those 2
3
u/vinaykumarha Full-Stack Developer Jan 30 '24
We are using REST based and asynchronous messaging like queues, pub-sub pattern. Orchestration is part of microservice ?
4
u/3AMgeek Software Engineer Jan 30 '24
When to go with RabbitMQ and When to go with Kafka.
I'm learning Microservices in Spring Boot. So far I have covered all the other topics just these two concepts are remaining.
Also, I tried to learn Kafka. And I found it to be a little vast. So anyone can just mention what all things are required to learn for freshers perspective.
1
u/[deleted] Jan 30 '24
REST API?
1
u/Beginning-Ladder6224 Jan 30 '24
Neither of 1,2,3 are related to Micro services. Literally.
https://en.wikipedia.org/wiki/Enterprise_service_bus
Was in 2002. I am pretty sure most of the "micro" folks today did not even complete college then.
Thrift is compression mechanism. Nothing to do with micro everything to do with data compression. As compression mechanism - they do compression by being typed.
gRPC is a RPC prototocl from Google. Nothing to do with micro, everything to do with remote service calls.
https://en.wikipedia.org/wiki/Remote_procedure_call
Being said that - earlier grpc ran over TCP can be moved to UDP.
https://learn.microsoft.com/en-us/aspnet/core/grpc/performance?view=aspnetcore-8.0
https://github.com/grpc/grpc-dotnet/issues/1049
Under the hood it is a wrapper over a transport mechanism.
None of them are to do anything with micro-services.
Now, if you were to read what and why of micro stuff here:
https://microservices.io
2
u/BhupeshV Moderator Jan 30 '24
Pinning this
2
u/[deleted] Jan 30 '24
That's not necessarily true. I have seen companies use SOA and they have some of the most complex products.
2
u/arav Site Reliability Engineer Jan 31 '24
All of the above are pretty standard practices used in intercommunication services. I'll mention below some of the worst and inefficient practices I've seen before.
1
u/Ok-One-4497 Fresher Jan 30 '24
I know about grpc had used long ago
1
u/shesha4572 Jan 30 '24
I had built a small distributed file system only using http rest apis for communication between master and slaves.
1
u/RaccoonDoor Software Engineer Jan 30 '24
My team uses RTI DDS for communication between services. It's confusing to learn but works beautifully. It basically abstracts away network and reliability concerns and is super efficient
1
u/No-Pick5821 Jan 30 '24
Hybrid. Independent architectures evolving on their own. This includes Rest based services which are resource oriented, grpc based services that are method oriented, some orchestrated via wflows, some running choreography, some using EDA, some using event sourcing, some running graphql. That is the point of micro services. Independent and uses the architecture that best suits them.
1
u/tamalm Backend Developer Jan 30 '24
I use grpc mostly for inter service comm. I have set up Kafka topics to get external messages. But Kafka is overkill, already migrated some parts to nats.
0
u/deezeddd Jan 30 '24
!Remind me 6 hours
0
u/WrongdoerSolid3898 Jan 30 '24
!Remind me in 6 hours
0
u/LearningMyDream Full-Stack Developer Jan 30 '24
!Remind Me 1 day
0
u/LearningMyDream Full-Stack Developer Jan 30 '24
!Remind me 1 day
0
u/cripplingleo Jan 30 '24
!Remind me 2 days