{"id":486038,"date":"2026-07-03T08:56:52","date_gmt":"2026-07-03T08:56:52","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=486038"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=486038","title":{"rendered":"gRPC \u0432 \u043c\u0438\u0440\u0435 PHP: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u044b\u0439 \u0433\u0430\u0439\u0434 \u043f\u043e \u0441\u0431\u043e\u0440\u043a\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 Symfony 7 \u0438 RoadRunner"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39d\/439\/d82\/39d439d82f8d047791a5164c08a4a7ac.png\" width=\"780\" height=\"440\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/39d\/439\/d82\/39d439d82f8d047791a5164c08a4a7ac.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39d\/439\/d82\/39d439d82f8d047791a5164c08a4a7ac.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 PHP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0436\u0438\u0432\u0443\u0442 \u043f\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u00ab\u0437\u0430\u043f\u0440\u043e\u0441 \u2014 \u043e\u0442\u0432\u0435\u0442\u00bb: \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 (\u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, Nginx) \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 PHP-FPM, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u0414\u043b\u044f REST API \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e, \u043d\u0430\u0434\u0451\u0436\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f\u043c\u0438. \u041d\u043e \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0432\u0441\u0451 \u0438\u043d\u0430\u0447\u0435: \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0430 \u043a \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0435 (latency) \u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u0438. \u0418\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0437\u0434\u0435\u0441\u044c \u0441\u0442\u0430\u043b <strong>gRPC<\/strong> \u2014 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043d\u0430 \u0431\u0430\u0437\u0435 HTTP\/2, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (Protobuf), \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (streaming) \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u044f\u0437\u044b\u043a\u043e\u0432.<\/p>\n<p>\u0414\u043e\u043b\u0433\u043e gRPC \u0432 PHP \u0441\u0447\u0438\u0442\u0430\u043b\u0441\u044f \u044d\u043a\u0437\u043e\u0442\u0438\u043a\u043e\u0439: \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 grpc \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Go \u0438\u043b\u0438 Java gRPC \u2014 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b: \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0437 .proto, \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u043a\u0430\u043a long-running \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b. \u0412 PHP \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0440\u0430\u0437\u0431\u043e\u0440 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 HTTP\/2-\u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u043e\u043a\u0435\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 grpc: \u0435\u0433\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 C-\u043a\u043e\u0434 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e. \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0432\u044f\u0437\u043a\u0430 <strong>PECL grpc + PHP-FPM<\/strong> \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. FPM \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 worker. TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 HTTP\/2 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0432\u0451\u0442\u0441\u044f, \u043f\u043b\u043e\u0445\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0430 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 RPC \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u0430\u043d\u0430\u043b\u0435 \u0442\u0435\u0440\u044f\u0435\u0442 \u0441\u043c\u044b\u0441\u043b. \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 RPC Symfony \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e: autoload, \u043f\u0440\u043e\u0433\u0440\u0435\u0432 DI-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u0432\u0430 \u043f\u0443\u0442\u0438: \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 PHP-\u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 gRPC, \u0438\u043b\u0438 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u0432 FPM. \u041e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u044e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u043f\u043b\u043e\u0445\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c Symfony-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412\u044b\u0445\u043e\u0434 \u2014 <strong>\u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong>:<\/p>\n<ol>\n<li>\n<p><strong>RoadRunner<\/strong> (Go) \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 gRPC \u043f\u043e\u0432\u0435\u0440\u0445 HTTP\/2 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 PHP \u0447\u0435\u0440\u0435\u0437 Goridge. <strong>spiral\/roadrunner-grpc<\/strong> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>Symfony<\/strong> \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u0441\u0451, \u043a \u0447\u0435\u043c\u0443 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435: DI-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, Doctrine, \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441 \u043d\u0443\u043b\u044f \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c gRPC-\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 Symfony 8 + RoadRunner + PostgreSQL, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0434\u0432\u0430 RPC-\u0441\u0435\u0440\u0432\u0438\u0441\u0430: HelloService \u2014 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u044f\u0437\u0438 \u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. OrderService (\u0417\u0430\u043a\u0430\u0437\u044b) \u2014 \u0431\u0438\u0437\u043d\u0435\u0441-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 Doctrine ORM \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 API \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b grpcurl.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 <a href=\"https:\/\/github.com\/alexdontsov\/symfony-rpc-example\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 GitHub<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 gRPC \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0434\u043b\u044f \u043c\u0435\u0436\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0437\u0430\u0447\u0435\u043c gRPC \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>\u0414\u043b\u044f <strong>\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e<\/strong> \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 gRPC \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0443 REST \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u0442\u0440\u043e\u0433\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c HTTP\/2:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>REST (JSON)<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>gRPC (Protobuf)<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0424\u043e\u0440\u043c\u0430\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0422\u0435\u043a\u0441\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0439, \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">OpenAPI (\u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u0444\u0430\u043a\u0442\u0443\u043c)<\/p>\n<\/td>\n<td>\n<p align=\"left\">.proto<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">HTTP\/1.1<\/p>\n<\/td>\n<td>\n<p align=\"left\">HTTP\/2, \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0438\u043c\u0438\u043d\u0433<\/p>\n<\/td>\n<td>\n<p align=\"left\">SSE, WebSocket<\/p>\n<\/td>\n<td>\n<p align=\"left\">Unary, server\/client\/bidi<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0427\u0430\u0441\u0442\u044c toolchain<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0447\u0430\u0449\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u043d\u0430 REST \u0438\u043b\u0438 GraphQL. gRPC \u2014 \u044d\u0442\u043e \u043f\u0440\u043e service-to-service: \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438, \u0431\u0438\u043b\u043b\u0438\u043d\u0433, \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u0432\u0441\u0451, \u0447\u0442\u043e \u0436\u0438\u0432\u0451\u0442 \u0437\u0430 gateway.<\/p>\n<p><strong>\u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 RoadRunner, \u0430 \u043d\u0435 PHP-FPM<\/strong><\/p>\n<p>FPM \u0437\u0430\u0442\u043e\u0447\u0435\u043d \u043f\u043e\u0434 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441: \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043d\u044f\u043b\u0441\u044f, \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0443\u0448\u0451\u043b \u0432 \u043f\u0443\u043b \u0438\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f. \u0414\u043b\u044f gRPC \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u2014 HTTP\/2-\u043a\u0430\u043d\u0430\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0436\u0438\u0442\u044c \u0434\u043e\u043b\u0433\u043e, \u0430 bootstrap Symfony \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 RPC \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0440\u043e\u0433 \u043f\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p><strong>\u0421\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f RoadRunner<\/strong> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 Go: \u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0443\u043b PHP worker&#8217;\u043e\u0432, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 gRPC \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u0447\u0435\u0440\u0435\u0437 Goridge (pipes \u0438\u043b\u0438 TCP). PHP \u0432\u0438\u0434\u0438\u0442 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 request\/response. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u0445\u0435\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b RoadRunner \u0438 PHP-FPM:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ae2\/067\/59d\/ae206759de1f69e0dd7b1001b7608e12.png\" width=\"583\" height=\"1098\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ae2\/067\/59d\/ae206759de1f69e0dd7b1001b7608e12.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ae2\/067\/59d\/ae206759de1f69e0dd7b1001b7608e12.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h3>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Docker, \u0442\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<pre><code class=\"bash\">docker compose up -d --build<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u043e\u0434\u043d\u044f\u043b\u043e\u0441\u044c:<\/p>\n<pre><code>grpcurl -plaintext \\  -import-path proto -proto hello\/v1\/hello.proto \\  -d '{\"name\":\"Alex\"}' \\  localhost:9001 hello.v1.HelloService\/SayHello<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043e\u0442\u0432\u0435\u0442:  <\/p>\n<pre><code class=\"json\">{\"message\": \"Hello, Alex!\"}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041a\u043b\u0438\u0435\u043d\u0442 \u0448\u043b\u0451\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 protobuf \u043f\u043e HTTP\/2 \u2192 RoadRunner \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 gRPC \u2192 PHP worker \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 Goridge \u2192 Symfony-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043d\u0438\u0436\u0435:  <\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1cc\/ed8\/511\/1cced8511f5b9efeb045deb63f6943e9.png\" width=\"462\" height=\"682\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/1cc\/ed8\/511\/1cced8511f5b9efeb045deb63f6943e9.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1cc\/ed8\/511\/1cced8511f5b9efeb045deb63f6943e9.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u041f\u0443\u0442\u044c<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">proto\/<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u0432\u0435\u0440\u0441\u0438\u0438 API<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">generated\/<\/p>\n<\/td>\n<td>\n<p align=\"left\">DTO \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u2014 \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">src\/Grpc\/<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f RPC<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">src\/Entity\/, migrations\/<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441\u0445\u0435\u043c\u0430 \u0411\u0414<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">public\/grpc-worker.php<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043a\u043b\u0435\u0439\u043a\u0430 RoadRunner \u2194 Symfony<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">.rr.yaml<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043e\u0440\u0442\u044b, proto, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 worker<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">docker\/php-roadrunner\/<a href=\"http:\/\/entrypoint.sh\">entrypoint.sh<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">protoc, composer, \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>Hello-\u0441\u0435\u0440\u0432\u0438\u0441: \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043e RPC<\/h3>\n<p>Hello \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 RPC-\u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<h4>1. \u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 <code>proto\/hello\/v1\/hello.proto<\/code>. \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:<\/p>\n<p><code>syntax = \"proto3\";<\/p>\n<p>package hello.v1;<\/p>\n<p>option php_metadata_namespace =\"Generated\\\\GRPC\\\\Hello\\\\V1\\\\GPBMetadata\";<\/p>\n<p>option php_namespace = \"Generated\\\\GRPC\\\\Hello\\\\V1\";<\/p>\n<p>message SayHelloRequest {<br \/>\u00a0 string name = 1;<br \/>}<\/p>\n<p>message SayHelloResponse {<br \/>\u00a0 string message = 1;<br \/>}<\/p>\n<p>service HelloService {<br \/>\u00a0 rpc SayHello(SayHelloRequest) returns (SayHelloResponse);<br \/>}  <\/code><\/p>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u042d\u043b\u0435\u043c\u0435\u043d\u0442<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u0417\u0430\u0447\u0435\u043c<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>syntax = \"proto3\"<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u0435\u0440\u0441\u0438\u044f \u044f\u0437\u044b\u043a\u0430 Protobuf; \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 API \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 proto3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>package hello.v1<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043c\u044f API \u0438 <strong>\u0432\u0435\u0440\u0441\u0438\u044f<\/strong>; \u0432 gRPC \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f hello.v1.HelloService<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>php_namespace<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0442\u044c, \u043a\u0443\u0434\u0430 protoc \u043f\u043e\u043b\u043e\u0436\u0438\u0442 PHP-\u043a\u043b\u0430\u0441\u0441\u044b; \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 PSR-4 autoload<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>message<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u043e\u0442\u0432\u0435\u0442\u0430; \u043f\u043e\u043b\u0435 name = 1 \u2014 \u0438\u043c\u044f \u0438 <strong>\u043d\u043e\u043c\u0435\u0440<\/strong> (\u043d\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432 \u0444\u0430\u0439\u043b\u0435)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>service + rpc<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b; \u0437\u0434\u0435\u0441\u044c <strong>unary<\/strong> \u2014 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0434\u0438\u043d \u043e\u0442\u0432\u0435\u0442<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438: \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u043e\u043b\u0435\u0439 (1, 2, \u2026) \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442 \u0442\u0438\u043f. \u041d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u2014 \u043d\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440. \u0423\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442 reserved. Breaking change \u2192 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 hello.v2, \u0441\u0442\u0430\u0440\u044b\u0439 hello.v1 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>\u041f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 gRPC: <code>hello.v1.HelloService<\/code>, \u043c\u0435\u0442\u043e\u0434: <code>SayHello<\/code>. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 grpcurl: <code>hello.v1.HelloService\/SayHello<\/code>.<\/p>\n<h4>2. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f PHP<\/h4>\n<p>\u0418\u0437 .proto \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 DTO \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (\u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0438 \u043d\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e).<\/p>\n<pre><code class=\"bash\">mkdir -p generatedprotoc \\  --proto_path=proto \\  --php_out=generated \\  --plugin=protoc-gen-php-grpc=\/usr\/local\/bin\/protoc-gen-php-grpc \\  --php-grpc_out=generated \\  hello\/v1\/hello.proto<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p><strong>\u0424\u043b\u0430\u0433<\/strong><\/p>\n<\/th>\n<th>\n<p><strong>\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong><\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">&#8212;proto_path=proto<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041a\u043e\u0440\u0435\u043d\u044c \u0434\u043b\u044f import \u0438 \u043f\u0443\u0442\u0435\u0439 \u043a \u0444\u0430\u0439\u043b\u0430\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">&#8212;php_out=generated<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (SayHelloRequest, SayHelloResponse)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">&#8212;php-grpc_out=generated<\/p>\n<\/td>\n<td>\n<p align=\"left\">gRPC-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (HelloServiceInterface)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">&#8212;plugin=protoc-gen-php-grpc=&#8230;<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043b\u0430\u0433\u0438\u043d RoadRunner \u0434\u043b\u044f PHP gRPC<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"bash\">generated\/\u2514\u2500\u2500 Generated\/\u2514\u2500\u2500 GRPC\/\u2514\u2500\u2500 Hello\/\u2514\u2500\u2500 V1\/\u251c\u2500\u2500 HelloServiceInterface.php\u251c\u2500\u2500 SayHelloRequest.php\u251c\u2500\u2500 SayHelloResponse.php\u2514\u2500\u2500 GPBMetadata\/\u2514\u2500\u2500 Hello.php<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c <code>generated\/Generated\/<\/code> \u2014 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430 <code>protoc<\/code>, \u0432 <code>composer.json<\/code> \u0441\u0435\u043a\u0446\u0438\u0438 Autoload \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: <code>\"Generated\\\\\": \"generated\/Generated\/\".<\/code><\/p>\n<p>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2014 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044f\u0437\u0430\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:  <\/p>\n<pre><code class=\"bash\">interface HelloServiceInterface extends GRPC\\ServiceInterface {    public const NAME = \"hello.v1.HelloService\";    public function SayHello(ContextInterface $ctx, SayHelloRequest $in): SayHelloResponse;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 <code>NAME<\/code> \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 gRPC \u2014 RoadRunner \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0451 \u043f\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0424\u0430\u0439\u043b\u044b \u0432 <code>generated\/<\/code> \u043d\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e: \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 <code>.proto<\/code> \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h4>3. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 Symfony<\/h4>\n<p>gRPC-\u0441\u0435\u0440\u0432\u0438\u0441 \u0432 Symfony \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 PHP-\u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. HTTP-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0440\u043e\u0443\u0442\u044b \u0438 framework.router \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u044b.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c <code>src\/Grpc\/HelloService.php<\/code>:<\/p>\n<pre><code class=\"php\">&lt;?phpdeclare(strict_types=1);namespace App\\Grpc;use Generated\\GRPC\\Hello\\V1\\HelloServiceInterface;use Generated\\GRPC\\Hello\\V1\\SayHelloRequest;use Generated\\GRPC\\Hello\\V1\\SayHelloResponse;use Spiral\\RoadRunner\\GRPC\\ContextInterface;final class HelloService implements HelloServiceInterface {    public function SayHello(ContextInterface $ctx, SayHelloRequest $in): SayHelloResponse {        $name = trim($in-&gt;getName()) !== '' ? $in-&gt;getName() : 'World';        return new SayHelloResponse()-&gt;setMessage(sprintf('Hello, %s!', $name));    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0427\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435:<\/p>\n<ul>\n<li>\n<p><strong>ContextInterface $ctx<\/strong> \u2014 metadata \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 (\u0430\u043d\u0430\u043b\u043e\u0433 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432): trace-id, JWT, deadline. \u0412 Hello \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043d\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443.<\/p>\n<\/li>\n<li>\n<p><strong>SayHelloRequest $in<\/strong> \u2014 \u0443\u0436\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 protobuf; \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u043b\u044f\u043c \u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b getName(), hasName().<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043e\u0437\u0432\u0440\u0430\u0442 SayHelloResponse<\/strong> \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0442\u0432\u0435\u0442\u0430; \u0443 protobuf-\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u044b set* \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 $this (fluent).<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 DI. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u044b Symfony \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435; worker \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 $container-&gt;get(), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c:<\/p>\n<pre><code class=\"yaml\">services:   App:     resource: '..\/src\/'   App\\Grpc\\HelloService:      public: true<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 Hello <strong>\u0435\u0449\u0451 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0441\u043d\u0430\u0440\u0443\u0436\u0438<\/strong> \u2014 \u043a\u043b\u0430\u0441\u0441 \u0435\u0441\u0442\u044c, \u043d\u043e RoadRunner \u043e \u043d\u0451\u043c \u043d\u0435 \u0437\u043d\u0430\u0435\u0442. \u0421\u0432\u044f\u0437\u043a\u0443 \u00ab\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2192 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2192 gRPC-\u043f\u043e\u0440\u0442\u00bb \u0434\u0435\u043b\u0430\u0435\u043c \u0432 worker (\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0434\u0435\u043b).<\/p>\n<h2>Worker \u0438 RoadRunner  <\/h2>\n<pre><code class=\"php\">public\/grpc-worker.php \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 PHP:(new Dotenv())-&gt;bootEnv(dirname(__DIR__) . '\/.env');$kernel = new Kernel($_SERVER['APP_ENV'] ?? 'dev', (bool) ($_SERVER['APP_DEBUG'] ?? true));$kernel-&gt;boot();$container = $kernel-&gt;getContainer();$server = new Server();$server-&gt;registerService(HelloServiceInterface::class, $container-&gt;get(HelloService::class));$server-&gt;registerService(OrderServiceInterface::class, $container-&gt;get(OrderService::class));$server-&gt;serve(Worker::create());<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412 spiral\/roadrunner-grpc 3.x registerService \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <strong>FQCN \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430<\/strong> \u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. RoadRunner <strong>\u043d\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442<\/strong> .proto \u0441 PHP \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u2014 \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0430\u0440\u0443 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e.<\/p>\n<p><code>.rr.yaml:<\/code><\/p>\n<pre><code class=\"yaml\">version: \"3\"server:command: \"php public\/grpc-worker.php\"relay: pipesgrpc:listen: \"tcp:\/\/0.0.0.0:9001\"proto:- \"proto\/hello\/v1\/hello.proto\"- \"proto\/order\/v1\/order.proto\"rpc:listen: \"tcp:\/\/127.0.0.1:6001\"server:  command: \"php public\/grpc-worker.php\"  relay: pipesgrpc:  listen: \"tcp:\/\/0.0.0.0:9001\"  proto:    - \"proto\/hello\/v1\/hello.proto\"    - \"proto\/order\/v1\/order.proto\"rpc:  listen: \"tcp:\/\/127.0.0.1:6001\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435: server.command \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 worker, grpc.listen \u2014 \u0430\u0434\u0440\u0435\u0441 gRPC, grpc.proto \u2014 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f reflection\/\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 RR.<\/p>\n<h3>\u0421\u0435\u0440\u0432\u0438\u0441 \u0437\u0430\u043a\u0430\u0437\u043e\u0432<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 Hello-\u0432\u043e\u0440\u043a\u0435\u0440 \u0432\u043e \u0447\u0442\u043e-\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u043e\u0435. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430\u043c\u0438 \u2014 OrderService. \u041e\u043d \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430: <strong>CreateOrder<\/strong> (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u0437\u0430) \u0438 <strong>ListOrders<\/strong> (\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430).<\/p>\n<p><strong>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0438 \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b<\/strong><\/p>\n<ol>\n<li>\n<p><strong>\u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong>: \u0421\u0443\u0449\u043d\u043e\u0441\u0442\u044c Order \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 orders. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Doctrine-\u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e Version20260530120000.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 CreateOrder<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u043e\u043b\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 symfony\/validator.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0437\u0430\u043a\u0430\u0437 \u0432 \u0411\u0414 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c new.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 id \u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u0442\u043e\u0434 ListOrders<\/strong>:<\/p>\n<ul>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u0443\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 limit \u0438 offset.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 Order \u0438 \u043e\u0431\u0449\u0435\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (total) \u0434\u043b\u044f \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a<\/strong>: \u0415\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430, \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 GRPCException \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c gRPC-\u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c INVALID_ARGUMENT, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0447\u0435\u0440\u0435\u0437 grpcurl<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 DTO \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 RoadRunner \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b grpcurl.<\/p>\n<p><strong>1. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043a\u0430\u0437\u0430:<\/strong><\/p>\n<pre><code class=\"bash\">grpcurl -plaintext -import-path proto -proto order\/v1\/order.proto \\  -d '{\"customer_name\":\"Alex\",\"product\":\"Widget\",\"quantity\":2}' \\  localhost:9001 order.v1.OrderService\/CreateOrder<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<pre><code class=\"json\"># \u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043e\u0442\u0432\u0435\u0442:# { \"id\": \"1\", \"status\": \"new\" }<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>2. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0437\u0430\u043a\u0430\u0437\u043e\u0432:<\/strong><\/p>\n<pre><code class=\"bash\">grpcurl -plaintext -import-path proto -proto order\/v1\/order.proto \\  -d '{\"limit\":10,\"offset\":0}' \\  localhost:9001 order.v1.OrderService\/ListOrders<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0421\u0432\u044f\u0437\u043a\u0430 <strong>Symfony + RoadRunner + Protobuf<\/strong> \u0434\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442: \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 PHP \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0433\u043e\u0442\u043e\u0432 \u043a \u0432\u044b\u0441\u043e\u043a\u0438\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 gRPC-\u0441\u0435\u0440\u0432\u0435\u0440, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 DX (Developer Experience). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0442\u0435\u043a\u0430 \u0447\u0435\u0442\u043a\u043e \u0438\u0437\u043e\u043b\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u044e \u0437\u043e\u043d\u0443 \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p><strong>Protobuf<\/strong> \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0438 \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0443\u044e \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Symfony<\/strong> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438 (DI) \u0438 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>RoadRunner<\/strong> \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c (HTTP\/2), \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u043e\u043c \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 (long-running) \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f \u2014 \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u0430 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 production-\u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u0430\u0440\u043a\u0430\u0441 \u0432 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0431\u043e\u0435\u0432\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0443 long-running \u0441\u0440\u0435\u0434\u044b.<\/p>\n<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0430 \u043a enterprise-\u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u043c \u0432 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<ul>\n<li>\n<p><strong>\u041c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442 \u043f\u0430\u043c\u044f\u0442\u0438 (Memory Leaks)<\/strong>: \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043b\u044e\u0431\u0430\u044f \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043d\u0435\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0439 \u043b\u043e\u0433\u0433\u0435\u0440 \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435) \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0432\u043e\u0440\u043a\u0435\u0440\u0430. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443 max_jobs \u0438\u043b\u0438 \u043b\u0438\u043c\u0438\u0442\u044b \u043f\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u0432 roadrunner.yaml \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0435\u0441\u0442\u0430\u0440\u0442\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 (Stateful Connections)<\/strong>: \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (Doctrine) \u0438\u043b\u0438 \u0431\u0440\u043e\u043a\u0435\u0440\u0430\u043c\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u0432\u0430\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u0443. \u041d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (ping\/reconnect) \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0438\u043b\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0439\u0442\u0435 EntityManager \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a<\/strong>: \u041e\u0448\u0438\u0431\u043a\u0438 \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u0435\u0442\u0438 (broken pipes, \u0442\u0430\u0439\u043c\u0430\u0443\u0442\u044b \u0441\u043e\u043a\u0435\u0442\u043e\u0432) \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0432\u0441\u0435\u0433\u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0430. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u044e \u0438\u0445 \u0432 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0435 gRPC-\u0441\u0442\u0430\u0442\u0443\u0441\u044b (INTERNAL, UNAVAILABLE).<\/p>\n<\/li>\n<li>\n<p><strong>Observability (\u041c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433)<\/strong>: \u0418\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a. RoadRunner \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0443\u043c\u0435\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0434\u043b\u044f Prometheus (\u043f\u043b\u0430\u0433\u0438\u043d metrics).<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c (TLS\/mTLS)<\/strong>: \u0412\u043d\u0443\u0442\u0440\u0438 \u043f\u0435\u0440\u0438\u043c\u0435\u0442\u0440\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043e. \u041d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 (gRPC over TLS) \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 RoadRunner \u0438\u043b\u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u0443\u0439\u0442\u0435 \u044d\u0442\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 Service Mesh (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Istio).<\/p>\n<\/li>\n<\/ul>\n<h3>\u0421\u0441\u044b\u043b\u043a\u0438<\/h3>\n<ul>\n<li>\n<p><a href=\"https:\/\/docs.roadrunner.dev\/docs\/grpc\">RoadRunner \u2014 gRPC<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/roadrunner-php\/grpc\">spiral\/roadrunner-grpc<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/protobuf.dev\/\">Protocol Buffers<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/symfony.com\/doc\/current\/configuration\/micro_kernel_trait.html\">Symfony MicroKernel<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/fullstorydev\/grpcurl\">grpcurl<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410\u0432\u0442\u043e\u0440 \u0442\u0435\u043a\u0441\u0442\u0430<\/strong> \u2014\u00a0\u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u0414\u043e\u043d\u0446\u043e\u0432<\/p>\n<hr\/>\n<p>\u041d\u041b\u041e \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u043b\u043e \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u043c\u043e\u043a\u043e\u0434 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430:<br \/><a href=\"https:\/\/firstvds.ru\/?utm%5C%5C_source=habr&amp;utm%5C%5C_medium=article&amp;utm%5C%5C_campaign=product&amp;utm%5C%5C_content=vds15exeptprogrev\">-15% \u043d\u0430 \u0437\u0430\u043a\u0430\u0437 \u043d\u043e\u0432\u043e\u0433\u043e VDS<\/a>\u00a0\u2014\u00a0<strong>HABRFIRSTVDS<\/strong>.<\/p>\n<p><a href=\"https:\/\/firstvds.ru\/habr15\">\u041f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0431 \u0430\u043a\u0446\u0438\u0438<\/a><\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1055128\/\">https:\/\/habr.com\/ru\/articles\/1055128\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 PHP-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0436\u0438\u0432\u0443\u0442 \u043f\u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u00ab\u0437\u0430\u043f\u0440\u043e\u0441 \u2014 \u043e\u0442\u0432\u0435\u0442\u00bb: \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 (\u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, Nginx) \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 PHP-FPM, \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u0414\u043b\u044f REST API \u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e, \u043d\u0430\u0434\u0451\u0436\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f\u043c\u0438. \u041d\u043e \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0432\u0441\u0451 \u0438\u043d\u0430\u0447\u0435: \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u0431\u0449\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439, \u0430 \u043a \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0435 (latency) \u0438 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u043e\u0432 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u0438. \u0418\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u0437\u0434\u0435\u0441\u044c \u0441\u0442\u0430\u043b gRPC \u2014 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043d\u0430 \u0431\u0430\u0437\u0435 HTTP\/2, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 (Protobuf), \u043d\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (streaming) \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u044f\u0437\u044b\u043a\u043e\u0432.\u0414\u043e\u043b\u0433\u043e gRPC \u0432 PHP \u0441\u0447\u0438\u0442\u0430\u043b\u0441\u044f \u044d\u043a\u0437\u043e\u0442\u0438\u043a\u043e\u0439: \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 grpc \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c, \u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u0434\u043e\u043b\u0433\u043e\u0436\u0438\u0432\u0443\u0449\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 Go \u0438\u043b\u0438 Java gRPC \u2014 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b: \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0438\u0437 .proto, \u0441\u0435\u0440\u0432\u0435\u0440\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u043a\u0430\u043a long-running \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b. \u0412 PHP \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0440\u0430\u0437\u0431\u043e\u0440 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 HTTP\/2-\u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u043e\u043a\u0435\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 grpc: \u0435\u0433\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 C-\u043a\u043e\u0434 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e. \u041d\u043e \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0441\u0432\u044f\u0437\u043a\u0430 PECL grpc + PHP-FPM \u0443\u043f\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. FPM \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043b\u0438\u0431\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 worker. TCP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 HTTP\/2 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0432\u0451\u0442\u0441\u044f, \u043f\u043b\u043e\u0445\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0430 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 RPC \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u0430\u043d\u0430\u043b\u0435 \u0442\u0435\u0440\u044f\u0435\u0442 \u0441\u043c\u044b\u0441\u043b. \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 RPC Symfony \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043d\u043e\u0432\u043e: autoload, \u043f\u0440\u043e\u0433\u0440\u0435\u0432 DI-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0434\u0432\u0430 \u043f\u0443\u0442\u0438: \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 PHP-\u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 gRPC, \u0438\u043b\u0438 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432\u044b \u0432 FPM. \u041e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u044e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u043f\u043b\u043e\u0445\u043e \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c Symfony-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.\u0412\u044b\u0445\u043e\u0434 \u2014 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:RoadRunner (Go) \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 gRPC \u043f\u043e\u0432\u0435\u0440\u0445 HTTP\/2 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 PHP \u0447\u0435\u0440\u0435\u0437 Goridge. spiral\/roadrunner-grpc \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432.Symfony \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0432\u0441\u0451, \u043a \u0447\u0435\u043c\u0443 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435: DI-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440, Doctrine, \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u043d\u0441\u043e\u043b\u044c.\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0441 \u043d\u0443\u043b\u044f \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c gRPC-\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 \u0441\u0442\u0435\u043a\u0435 Symfony 8 + RoadRunner + PostgreSQL, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0434\u0432\u0430 RPC-\u0441\u0435\u0440\u0432\u0438\u0441\u0430: HelloService \u2014 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0432\u044f\u0437\u0438 \u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430. OrderService (\u0417\u0430\u043a\u0430\u0437\u044b) \u2014 \u0431\u0438\u0437\u043d\u0435\u0441-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043a\u0430\u0437\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043f\u0438\u0441\u043a\u0430. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 Doctrine ORM \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0435 API \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b grpcurl.\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430 GitHub, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u0435 \u0438 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435.\u041f\u043e\u0447\u0435\u043c\u0443 gRPC \u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0434\u043b\u044f \u043c\u0435\u0436\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0437\u0430\u0447\u0435\u043c gRPC \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435.\u0414\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 gRPC \u043e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0443 REST \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u0442\u0440\u043e\u0433\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c HTTP\/2:\u041a\u0440\u0438\u0442\u0435\u0440\u0438\u0439REST (JSON)gRPC (Protobuf)\u0424\u043e\u0440\u043c\u0430\u0442\u0422\u0435\u043a\u0441\u0442\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0439, \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439\u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442OpenAPI (\u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u0444\u0430\u043a\u0442\u0443\u043c).proto\u0422\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442HTTP\/1.1HTTP\/2, \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u0421\u0442\u0440\u0438\u043c\u0438\u043d\u0433SSE, WebSocketUnary, server\/client\/bidi\u041a\u043e\u0434\u043e\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f\u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0430\u0427\u0430\u0441\u0442\u044c toolchain\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 API \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043e\u0432 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0447\u0430\u0449\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u043d\u0430 REST \u0438\u043b\u0438 GraphQL. gRPC \u2014 \u044d\u0442\u043e \u043f\u0440\u043e service-to-service: \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438, \u0431\u0438\u043b\u043b\u0438\u043d\u0433, \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u044f, \u0432\u0441\u0451, \u0447\u0442\u043e \u0436\u0438\u0432\u0451\u0442 \u0437\u0430 gateway.\u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 RoadRunner, \u0430 \u043d\u0435 PHP-FPMFPM \u0437\u0430\u0442\u043e\u0447\u0435\u043d \u043f\u043e\u0434 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441: \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043d\u044f\u043b\u0441\u044f, \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b, \u0443\u0448\u0451\u043b \u0432 \u043f\u0443\u043b \u0438\u043b\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f. \u0414\u043b\u044f gRPC \u044d\u0442\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u2014 HTTP\/2-\u043a\u0430\u043d\u0430\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0436\u0438\u0442\u044c \u0434\u043e\u043b\u0433\u043e, \u0430 bootstrap Symfony \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 RPC \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0434\u043e\u0440\u043e\u0433 \u043f\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.\u0421\u0435\u0440\u0432\u0435\u0440 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f RoadRunner \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 Go: \u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0443\u043b PHP worker&#8217;\u043e\u0432, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 gRPC \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0432\u044b\u0437\u043e\u0432\u044b \u0447\u0435\u0440\u0435\u0437 Goridge (pipes \u0438\u043b\u0438 TCP). PHP \u0432\u0438\u0434\u0438\u0442 \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 request\/response. \u041d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0441\u0445\u0435\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b RoadRunner \u0438 PHP-FPM:\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Docker, \u0442\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:docker compose up -d &#8212;build\u0421\u0440\u0430\u0437\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u043e\u0434\u043d\u044f\u043b\u043e\u0441\u044c:grpcurl -plaintext \\  -import-path proto -proto hello\/v1\/hello.proto \\  -d &#8216;{&#171;name&#187;:&#187;Alex&#187;}&#8217; \\  localhost:9001 hello.v1.HelloService\/SayHello\u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043e\u0442\u0432\u0435\u0442:  {&#171;message&#187;: &#171;Hello, Alex!&#187;}\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041a\u043b\u0438\u0435\u043d\u0442 \u0448\u043b\u0451\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 protobuf \u043f\u043e HTTP\/2 \u2192 RoadRunner \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 gRPC \u2192 PHP worker \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 Goridge \u2192 Symfony-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043d\u0438\u0436\u0435:  \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0441 \u043a\u0440\u0430\u0442\u043a\u0438\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c.\u041f\u0443\u0442\u044c\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435proto\/\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u0432\u0435\u0440\u0441\u0438\u0438 APIgenerated\/DTO \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u2014 \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044esrc\/Grpc\/\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f RPCsrc\/Entity\/, migrations\/\u041c\u043e\u0434\u0435\u043b\u044c \u0438 \u0441\u0445\u0435\u043c\u0430 \u0411\u0414public\/grpc-worker.php\u0421\u043a\u043b\u0435\u0439\u043a\u0430 RoadRunner \u2194 Symfony.rr.yaml\u041f\u043e\u0440\u0442\u044b, proto, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 workerdocker\/php-roadrunner\/entrypoint.shprotoc, composer, \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435Hello-\u0441\u0435\u0440\u0432\u0438\u0441: \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0434\u043e RPCHello \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 RPC-\u0441\u0435\u0440\u0432\u0438\u0441\u0430.1. \u041a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 proto\/hello\/v1\/hello.proto. \u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:syntax = &#171;proto3&#8243;;package hello.v1;option php_metadata_namespace =&#187;Generated\\\\GRPC\\\\Hello\\\\V1\\\\GPBMetadata&#187;;option php_namespace = &#171;Generated\\\\GRPC\\\\Hello\\\\V1&#187;;message SayHelloRequest {\u00a0 string name = 1;}message SayHelloResponse {\u00a0 string message = 1;}service HelloService {\u00a0 rpc SayHello(SayHelloRequest) returns (SayHelloResponse);}  \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440:\u042d\u043b\u0435\u043c\u0435\u043d\u0442\u0417\u0430\u0447\u0435\u043csyntax = &#171;proto3&#8243;\u0412\u0435\u0440\u0441\u0438\u044f \u044f\u0437\u044b\u043a\u0430 Protobuf; \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 API \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 proto3package hello.v1\u041b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043c\u044f API \u0438 \u0432\u0435\u0440\u0441\u0438\u044f; \u0432 gRPC \u0441\u0435\u0440\u0432\u0438\u0441 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f hello.v1.HelloServicephp_namespace\u041f\u0443\u0442\u044c, \u043a\u0443\u0434\u0430 protoc \u043f\u043e\u043b\u043e\u0436\u0438\u0442 PHP-\u043a\u043b\u0430\u0441\u0441\u044b; \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 PSR-4 autoloadmessage\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\/\u043e\u0442\u0432\u0435\u0442\u0430; \u043f\u043e\u043b\u0435 name = 1 \u2014 \u0438\u043c\u044f \u0438 \u043d\u043e\u043c\u0435\u0440 (\u043d\u0435 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432 \u0444\u0430\u0439\u043b\u0435)service + rpc\u041f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b; \u0437\u0434\u0435\u0441\u044c unary \u2014 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u0434\u0438\u043d \u043e\u0442\u0432\u0435\u0442\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438: \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u043e\u043b\u0435\u0439 (1, 2, \u2026) \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0438 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442 \u0442\u0438\u043f. \u041d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u2014 \u043d\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440. \u0423\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442 reserved. Breaking change \u2192 \u043d\u043e\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 hello.v2, \u0441\u0442\u0430\u0440\u044b\u0439 hello.v1 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.\u041f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f \u0432 gRPC: hello.v1.HelloService, \u043c\u0435\u0442\u043e\u0434: SayHello. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 grpcurl: hello.v1.HelloService\/SayHello.2. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f PHP\u0418\u0437 .proto \u043c\u043e\u0436\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 DTO \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 (\u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0438 \u043d\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e).mkdir -p generatedprotoc \\  &#8212;proto_path=proto \\  &#8212;php_out=generated \\  &#8212;plugin=protoc-gen-php-grpc=\/usr\/local\/bin\/protoc-gen-php-grpc \\  &#8212;php-grpc_out=generated \\  hello\/v1\/hello.proto\u0424\u043b\u0430\u0433\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435&#8212;proto_path=proto\u041a\u043e\u0440\u0435\u043d\u044c \u0434\u043b\u044f import \u0438 \u043f\u0443\u0442\u0435\u0439 \u043a \u0444\u0430\u0439\u043b\u0430\u043c&#8212;php_out=generated\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (SayHelloRequest, SayHelloResponse)&#8212;php-grpc_out=generatedgRPC-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (HelloServiceInterface)&#8212;plugin=protoc-gen-php-grpc=&#8230;\u041f\u043b\u0430\u0433\u0438\u043d RoadRunner \u0434\u043b\u044f PHP gRPC\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u043e\u0441\u043b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430:generated\/\u2514\u2500\u2500 Generated\/\u2514\u2500\u2500 GRPC\/\u2514\u2500\u2500 Hello\/\u2514\u2500\u2500 V1\/\u251c\u2500\u2500 HelloServiceInterface.php\u251c\u2500\u2500 SayHelloRequest.php\u251c\u2500\u2500 SayHelloResponse.php\u2514\u2500\u2500 GPBMetadata\/\u2514\u2500\u2500 Hello.php\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c generated\/Generated\/ \u2014 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430 protoc, \u0432 composer.json \u0441\u0435\u043a\u0446\u0438\u0438 Autoload \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435: &#171;Generated\\\\&#187;: &#171;generated\/Generated\/&#187;.\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2014 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044f\u0437\u0430\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f:  interface HelloServiceInterface extends GRPC\\ServiceInterface {    public const NAME = &#171;hello.v1.HelloService&#187;;    public function SayHello(ContextInterface $ctx, SayHelloRequest $in): SayHelloResponse;}\u041a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 NAME \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432 gRPC \u2014 RoadRunner \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0451 \u043f\u0440\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432. \u0424\u0430\u0439\u043b\u044b \u0432 generated\/ \u043d\u0435 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u044e\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e: \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 .proto \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.3. \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 SymfonygRPC-\u0441\u0435\u0440\u0432\u0438\u0441 \u0432 Symfony \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 PHP-\u043a\u043b\u0430\u0441\u0441, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. HTTP-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u0440\u043e\u0443\u0442\u044b \u0438 framework.router \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u044b.\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c src\/Grpc\/HelloService.php:&lt;?phpdeclare(strict_types=1);namespace App\\Grpc;use Generated\\GRPC\\Hello\\V1\\HelloServiceInterface;use Generated\\GRPC\\Hello\\V1\\SayHelloRequest;use Generated\\GRPC\\Hello\\V1\\SayHelloResponse;use Spiral\\RoadRunner\\GRPC\\ContextInterface;final class HelloService implements HelloServiceInterface {    public function SayHello(ContextInterface $ctx, SayHelloRequest $in): SayHelloResponse {        $name = trim($in-&gt;getName()) !== &#187; ? $in-&gt;getName() : &#8216;World&#8217;;        return new SayHelloResponse()-&gt;setMessage(sprintf(&#8216;Hello, %s!&#8217;, $name));    }}\u0427\u0442\u043e \u0432\u0430\u0436\u043d\u043e \u0432 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435:ContextInterface $ctx \u2014 metadata \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 (\u0430\u043d\u0430\u043b\u043e\u0433 HTTP-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432): trace-id, JWT, deadline. \u0412 Hello \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043d\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443.SayHelloRequest $in \u2014 \u0443\u0436\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 protobuf; \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u043b\u044f\u043c \u0447\u0438\u0442\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043c\u0435\u0442\u043e\u0434\u044b getName(), hasName().\u0412\u043e\u0437\u0432\u0440\u0430\u0442 SayHelloResponse \u2014 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0442\u0432\u0435\u0442\u0430; \u0443 protobuf-\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u044b set* \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 $this (fluent).\u0417\u0430\u0442\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0432 DI. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0435\u0440\u0432\u0438\u0441\u044b Symfony \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435; worker \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 $container-&gt;get(), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043c\u0435\u0447\u0430\u0435\u043c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c:services:   App:     resource: &#8216;..\/src\/&#8217;   App\\Grpc\\HelloService:      public: true\u041d\u0430 \u044d\u0442\u043e\u043c \u044d\u0442\u0430\u043f\u0435 Hello \u0435\u0449\u0451 \u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u2014 \u043a\u043b\u0430\u0441\u0441 \u0435\u0441\u0442\u044c, \u043d\u043e RoadRunner \u043e \u043d\u0451\u043c \u043d\u0435 \u0437\u043d\u0430\u0435\u0442. \u0421\u0432\u044f\u0437\u043a\u0443 \u00ab\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2192 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2192 gRPC-\u043f\u043e\u0440\u0442\u00bb \u0434\u0435\u043b\u0430\u0435\u043c \u0432 worker (\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0434\u0435\u043b).Worker \u0438 RoadRunner  public\/grpc-worker.php \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 PHP:(new Dotenv())-&gt;bootEnv(dirname(__DIR__) . &#8216;\/.env&#8217;);$kernel = new Kernel($_SERVER[&#8216;APP_ENV&#8217;] ?? &#8216;dev&#8217;, (bool) ($_SERVER[&#8216;APP_DEBUG&#8217;] ?? true));$kernel-&gt;boot();$container = $kernel-&gt;getContainer();$server = new Server();$server-&gt;registerService(HelloServiceInterface::class, $container-&gt;get(HelloService::class));$server-&gt;registerService(OrderServiceInterface::class, $container-&gt;get(OrderService::class));$server-&gt;serve(Worker::create());\u0412 spiral\/roadrunner-grpc 3.x registerService \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 FQCN \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. RoadRunner \u043d\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 .proto \u0441 PHP \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u2014 \u043a\u0430\u0436\u0434\u0443\u044e \u043f\u0430\u0440\u0443 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-486038","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/486038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=486038"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/486038\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=486038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=486038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=486038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}