{"id":303028,"date":"2020-05-05T03:00:17","date_gmt":"2020-05-05T03:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=303028"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=303028","title":{"rendered":"\u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e R2DBC \u0438 PostgreSQL"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/500446\/\">\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043e\u043f\u044f\u0442\u044c \u0432\u0438\u0436\u0443, \u0447\u0442\u043e \u0443\u0441\u0438\u043b\u0438\u043b\u0441\u044f \u0445\u0430\u0439\u043f \u0432\u043e\u043a\u0440\u0443\u0433 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043e\u0431\u0449\u0435\u043c, \u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0411\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438. \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430 \u0444\u0440\u0430\u0437, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/691\/6cd\/f08\/6916cdf0853ff2457e7f18be72824260.png\" alt=\"image\"><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u044e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0441\u0435\u0440\u0438\u0438\u044f\u0445. \u0412 \u043a\u043e\u043d\u0446\u0435 2017 \u0432\u044b\u0448\u0435\u043b Spring 5, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e <a href=\"https:\/\/docs.spring.io\/spring-framework\/docs\/5.0.0.BUILD-SNAPSHOT\/spring-framework-reference\/html\/web-reactive.html\" rel=\"nofollow\">WebFlux<\/a>. \u0412\u0441\u0435 \u0441\u0442\u0430\u043b\u0438 \u0440\u0435\u0437\u043a\u043e \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e (\u0442\u0438\u043f\u0438\u0447\u043d\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f \u0445\u0430\u0439\u043f\u0430), \u0430 \u043f\u043e\u0442\u043e\u043c \u0432 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u0449\u0438\u043d\u0430 \u043d\u0443\u0436\u043d\u0430 \u043d\u0435 \u0432\u0441\u0435\u043c. \u0413\u043b\u0430\u0432\u043d\u044b\u0435 \u0443\u0441\u0432\u043e\u0435\u043d\u043d\u044b\u0435 \u0443\u0440\u043e\u043a\u0438:<\/p>\n<ul>\n<li>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u043e\u0442\u043b\u0430\u0434\u043a\u0435<\/li>\n<li>\u0420\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 \u0442\u0440\u0443\u0434\u043d\u0435\u0435, \u0447\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435\u0441\u044f; \u0435\u0441\u043b\u0438 \u043d\u0435\u0447\u0430\u0435\u043d\u043d\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0448\u044c thread \u2014 \u0442\u0435\u0431\u0435 \u043a\u043e\u043d\u0435\u0446. \u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 <a href=\"https:\/\/github.com\/reactor\/BlockHound\" rel=\"nofollow\">https:\/\/github.com\/reactor\/BlockHound<\/a> (\u043e\u0434\u0438\u043d \u0438\u0437 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 \u2014 <a href=\"https:\/\/habr.com\/ru\/users\/bsideup\/\" class=\"user_link\">bsideup<\/a> )<\/li>\n<li>\u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u2014 \u044d\u043b\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445 \u0430-\u043b\u044f Netflix. \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 100 RPS, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0432\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0441\u0442\u0438\u043b\u0435 \u2014 \u0442\u0430\u043a \u0434\u0435\u0448\u0435\u0432\u043b\u0435 \u0438 \u043f\u0440\u043e\u0449\u0435<\/li>\n<\/ul>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u0441\u0435 \u043f\u043e\u043d\u044f\u043b\u0438 \u0435\u0449\u0451 \u043e\u0434\u043d\u0443 \u0448\u0442\u0443\u043a\u0443. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u043b\u043e\u0441\u044c, \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0430\u0448\u0443 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0443 \u0411\u0414 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0432\u0441\u0435 \u0438 \u043d\u0435 \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e, \u0438\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e API. \u041d\u0443, \u0438\u043b\u0438 \u0442\u0430\u043a\u043e\u0435 API \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u043e \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0435\u043d\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435. <\/p>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0432\u043e\u043a\u0440\u0443\u0433 \u043c\u0435\u043d\u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0430 PostgreSQL, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0411\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0432\u044b\u0431\u043e\u0440 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0421 PostgreSQL \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0440\u043e\u0433\u043e (\u0435\u043c\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 10 \u043b\u0435\u0442) JDBC \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u2014 <a href=\"https:\/\/github.com\/pgjdbc\/pgjdbc\" rel=\"nofollow\">pgjdbc<\/a>. \u042d\u0442\u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0432\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448. \u0422\u0430\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435\u0442 \u0431\u0430\u0433\u043e\u0432. \u042d\u0442\u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d \u043f\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 (\u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u044d\u0442\u043e \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 <a href=\"https:\/\/habr.com\/ru\/users\/vladimirsitnikov\/\" class=\"user_link\">vladimirsitnikov<\/a> ). \u041d\u043e \u0432 pgjdbc \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u0444\u0430\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a \u2014 <a href=\"https:\/\/github.com\/impossibl\/pgjdbc-ng\/issues\/78\" rel=\"nofollow\">\u043d\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0436\u043a\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e API<\/a>. <\/p>\n<p>  \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0433\u043e\u0434\u044b \u043d\u0430\u0447\u0430\u043b\u0430\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0433\u043e\u043d\u043a\u0430 \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0434\u043b\u044f PostgreSQL, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0430\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e API. <a href=\"https:\/\/blogs.oracle.com\/java\/jdbc-next:-a-new-asynchronous-api-for-connecting-to-a-database\" rel=\"nofollow\">\u0414\u0430\u0436\u0435 Oracle \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f<\/a> \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u0443\u0436\u0435 <a href=\"https:\/\/mail.openjdk.java.net\/pipermail\/jdbc-spec-discuss\/2019-September\/000529.html\" rel=\"nofollow\">\u0437\u0430\u043a\u0440\u044b\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443<\/a> \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/openjdk.java.net\/projects\/loom\/\" rel=\"nofollow\">Loom \u0438 \u0435\u0433\u043e Fibers<\/a>. \u041d\u043e \u043f\u043e\u0442\u043e\u043c Oracle \u043e\u0434\u0443\u043c\u0430\u043b\u0430\u0441\u044c \u0438 <a href=\"https:\/\/groups.google.com\/forum\/?utm_medium=email&amp;utm_source=footer#!msg\/r2dbc\/A9s8rN7EOPA\/Db71lq2qAQAJ\" rel=\"nofollow\">\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043e\u043f\u044f\u0442\u044c<\/a>.<\/p>\n<p>  \u041f\u0440\u044f\u043c\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0435\u0441\u0442\u044c 3 \u0440\u0435\u0448\u0435\u043d\u0438\u044f: <\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/jasync-sql\/jasync-sql\" rel=\"nofollow\">https:\/\/github.com\/jasync-sql\/jasync-sql<\/a> \u2014 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f PostgreSQL, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Kotlin, \u0433\u0434\u0435 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043e\u043c \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0435\u0442 Netty<\/li>\n<li>\u0420\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <a href=\"https:\/\/vertx.io\/docs\/vertx-mysql-postgresql-client\/java\/\" rel=\"nofollow\">Vert.x<\/a> \u2014 <a href=\"https:\/\/github.com\/mauricio\/postgresql-async\" rel=\"nofollow\">https:\/\/github.com\/mauricio\/postgresql-async<\/a>. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d, \u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 jasync-sql \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043a\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e (\u043f\u0440\u0430\u0432\u0434\u0430, \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Scala, \u0430 \u043d\u043e\u0432\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043d\u0430 Kotlin).<\/li>\n<li>\u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b Spring \u2014 <a href=\"https:\/\/github.com\/r2dbc\/r2dbc-postgresql\" rel=\"nofollow\">https:\/\/github.com\/r2dbc\/r2dbc-postgresql<\/a>. \u042d\u0442\u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 API (\u0430 \u043d\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435), \u0430 \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0430, \u043a\u0430\u043a \u0438 \u0432 jasync-sql, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Netty.<\/li>\n<\/ol>\n<p>  \u041a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e, \u044d\u0442\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043d\u0430 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u0445. \u0412\u0441\u0435 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PostgreSQL:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.postgresql.org\/docs\/current\/libpq-async.html\" rel=\"nofollow\">https:\/\/www.postgresql.org\/docs\/current\/libpq-async.html<\/a><\/li>\n<li><a href=\"https:\/\/www.postgresql.org\/docs\/current\/libpq-notify.html\" rel=\"nofollow\">https:\/\/www.postgresql.org\/docs\/current\/libpq-notify.html<\/a><\/li>\n<\/ul>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c Wire protocol Postgres (\u043a\u0430\u043a \u0431\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u041e\u043b\u0435\u0433 \u0414\u043e\u043a\u0443\u043a\u0430 \u2014 <a href=\"https:\/\/www.youtube.com\/watch?v=n9tL2I_Big8\" rel=\"nofollow\">https:\/\/www.youtube.com\/watch?v=n9tL2I_Big8<\/a>). \u0422\u043e \u0435\u0441\u0442\u044c, Postgres \u0432\u0441\u0451 \u0435\u0449\u0451 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 Connection \u0434\u043b\u044f SELECT \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Postgres \u0432\u0441\u0451 \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e Connection \u2014 <a href=\"https:\/\/www.postgresql.org\/docs\/current\/tutorial-arch.html\" rel=\"nofollow\">https:\/\/www.postgresql.org\/docs\/current\/tutorial-arch.html<\/a>. <\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0438 \u0445\u043e\u0440\u043e\u0448\u0438\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u0438. \u041c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u043f\u0430\u0447\u043a\u043e\u0439, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pipeline). \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f Connection \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. <\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u043e\u0434\u044b\u0442\u043e\u0436\u0438\u043c. \u0420\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 (\u0438\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435) PG \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u044b \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 (\u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Netty based Non-blocking IO, \u043d\u0435 \u0442\u0440\u0430\u0442\u044f \u043f\u043e thread \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441), \u043d\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 PostgreSQL \u2014 \u0434\u0435\u043b\u0430 \u043d\u0435 \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u0438 (\u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u0411\u0414). <\/p>\n<p>  \u041d\u0430 \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0441\u0442\u0430\u043b\u044c\u043d\u043e? \u0415\u0441\u043b\u0438 \u0432\u044b, \u043a\u0430\u043a \u0438 \u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Spring \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u2014 \u0442\u043e, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, <strong>r2dbc-postgresql<\/strong> \u2014 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u044b\u0431\u043e\u0440. \u0412\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u0441\u0432\u043e\u0435\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 Pivotal \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 <a href=\"https:\/\/spring.io\/projects\/spring-data-r2dbc\" rel=\"nofollow\">Spring Data R2DBC<\/a> (\u044d\u0442\u043e \u043f\u043e\u043a\u0430 \u0435\u0449\u0451 RC). \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c API \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0438 \u041f\u0443\u043b\u043e\u043c \u0441\u043e\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439, \u0447\u0442\u043e \u043f\u043e\u043d\u0438\u0436\u0430\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u043e\u0436\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <\/p>\n<p>  \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438) \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Spring Data R2DBC \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e:<\/p>\n<p>  1. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c credentials \u0438 connection pool:  <\/p>\n<pre><code class=\"java\">spring.r2dbc.username=postgres spring.r2dbc.password=P4$$W0RddD spring.r2dbc.url=r2dbc:postgresql:\/\/localhost:5432\/r2dbc spring.r2dbc.pool.enabled=true spring.r2dbc.pool.initial-size=10 spring.r2dbc.pool.max-idle-time=1m spring.r2dbc.pool.max-size=30 spring.data.r2dbc.repositories.enabled=true <\/code><\/pre>\n<p>  2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c:  <\/p>\n<pre><code class=\"java\">public class Customer {     @Id     private Long id;      private String firstName;      private String lastName;      public Customer(String firstName, String lastName) {         this.firstName = firstName;         this.lastName = lastName;     } } <\/code><\/pre>\n<p>  3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u043d\u0430\u043c \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:  <\/p>\n<pre><code class=\"java\">public interface CustomerRepository extends ReactiveCrudRepository&lt;Customer, Long&gt; { } <\/code><\/pre>\n<p>  4. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:  <\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(&quot;\/&quot;) public class CustomerController {      private CustomerRepository customerRepository;      @PostMapping(&quot;\/customer&quot;)     Mono&lt;Void&gt; create(@RequestBody Publisher&lt;Customer&gt; customerFlux) {         return customerRepository.saveAll(customerFlux).then();     }      @GetMapping(&quot;\/customer&quot;)     public Flux&lt;Customer&gt; list() {         return customerRepository.findAll();     }      @GetMapping(&quot;\/customer\/{id}&quot;)     public Mono&lt;Customer&gt; findById(@PathVariable Long id) {         return customerRepository.findById(id);     } } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u2014 <a href=\"https:\/\/github.com\/Hixon10\/spring-boot-r2dbc-postgresql-example\" rel=\"nofollow\">https:\/\/github.com\/Hixon10\/spring-boot-r2dbc-postgresql-example<\/a>. <\/p>\n<p>  \u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0432\u0430\u0436\u043d\u043e\u043c: \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c r2dbc \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u0432\u0430\u0448\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445? \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u2014 \u043f\u043e\u043a\u0430 \u0440\u0430\u043d\u043e\u0432\u0430\u0442\u043e. \u042f \u0431\u044b \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u043b, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0431\u043e\u0440 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 (\u0434\u0440\u0430\u0439\u0432\u0435\u0440, Spring DATA) \u0437\u0430\u0440\u0435\u043b\u0438\u0437\u044f\u0442\u0441\u044f, \u0438 \u0441\u043e\u0431\u0438\u0440\u0443\u0442 \u043f\u0435\u0440\u0432\u044b\u0435 \u0448\u044b\u0448\u043a\u0438. \u042f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0432 2021 \u0433\u043e\u0434\u0443 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0441\u0442\u0430\u043b\u044c\u043d\u043e. <\/p>\n<p>  \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0434\u0435\u043b \u2014 \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 (Spring WebFlux + R2DBC database driver) \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e. \u0411\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f <a href=\"https:\/\/habr.com\/ru\/users\/olegchir\/\" class=\"user_link\">olegchir<\/a> \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b <a href=\"https:\/\/habr.com\/ru\/company\/jugru\/blog\/500332\/\">\u0434\u0430\u0439\u0434\u0436\u0435\u0441\u0442<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c\u0438 \u2014 <a href=\"https:\/\/technology.amis.nl\/2020\/04\/10\/spring-blocking-vs-non-blocking-r2dbc-vs-jdbc-and-webflux-vs-web-mvc\/\" rel=\"nofollow\">https:\/\/technology.amis.nl\/2020\/04\/10\/spring-blocking-vs-non-blocking-r2dbc-vs-jdbc-and-webflux-vs-web-mvc\/<\/a>. \u0412 \u043a\u0440\u0430\u0442\u0446\u0435 \u2014 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u0449\u0438\u043d\u0430 \u043f\u043e\u0431\u0435\u0436\u0434\u0430\u0435\u0442.<\/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\/post\/500446\/\"> https:\/\/habr.com\/ru\/post\/500446\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/500446\/\">\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u044f \u043e\u043f\u044f\u0442\u044c \u0432\u0438\u0436\u0443, \u0447\u0442\u043e \u0443\u0441\u0438\u043b\u0438\u043b\u0441\u044f \u0445\u0430\u0439\u043f \u0432\u043e\u043a\u0440\u0443\u0433 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043e\u0431\u0449\u0435\u043c, \u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0411\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438. \u0423 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430 \u0444\u0440\u0430\u0437, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0432\u043e\u0434\u0443. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/691\/6cd\/f08\/6916cdf0853ff2457e7f18be72824260.png\" alt=\"image\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-303028","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303028","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=303028"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/303028\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=303028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=303028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}