Answer the question
In order to leave comments, you need to log in
What are the approaches to building microservices in PHP?
Good afternoon!
I am familiar with the only way to prepare microservices in PHP without asynchrony (Swoole, Swoft and that's all) - this is a message queue. And the scheme there is something like this - we have a messaging service (Kafka, RabbitMq, etc.) and microservice workers that catch events are subscribed to it.
This approach solves the PHP problem - the lack of coroutines and asynchronous processing - in the case of sequentially calling microservices to each other, i.e. the execution thread does not wait for the http response, but throws the event into the queue and ok.
The approach is applicable to write operations and has a direct profit when more than 1 microservice must react to one event. And read operations go through the API Gateway by direct forwarding the request to the desired microservice.
And accordingly, the question is how to build microservices with gRPC?
Questions, in detail:
1. These are http calls, do I understand correctly? Those. in fact, the scheme remains the same - next to the PHP application container, nginx should be spinning, which pulls php-fpm?
2. I can not understand how it is in this case friendly with the non-asynchronous behavior of PHP? Or not friendly?
3. What is the profit?) Well, except for architectural goodies, when services can theoretically be designed as bundles - sticking out a high-level interface and calling it through gRPC.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question