{"id":336610,"date":"2022-08-05T09:00:53","date_gmt":"2022-08-05T09:00:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336610"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336610","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 Webflux<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div class=\"persona\" persona=\"true\"><img decoding=\"async\" persona=\"true\" class=\"image persona__image\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/e55\/bec\/44b\/e55bec44bdf0f54419c8c8d1e28cae03.jpg\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e55\/bec\/44b\/e55bec44bdf0f54419c8c8d1e28cae03.jpg\" data-blurred=\"true\"\/><\/p>\n<h5 class=\"persona__heading\" persona=\"true\">\u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u041b\u0435\u043e\u043d\u043e\u0432<\/h5>\n<p>\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/p>\n<\/div>\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 <a href=\"https:\/\/habr.com\/ru\/users\/venum\/\">\u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u041b\u0435\u043e\u043d\u043e\u0432<\/a>, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 Usetech. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0440\u043c\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 Webflux. \u0421\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 API \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0451\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/summary>\n<div class=\"spoiler__content\">\n<p><em>\u0412\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c, \u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/em><\/p>\n<p><em>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432, \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u043d\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043b\u044e\u0434\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0446\u0438\u0439!<\/em><\/p>\n<\/div>\n<\/details>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0434\u0435\u043d\u044c, \u0432 \u043b\u0441 \u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0441 \u043f\u0440\u043e\u0441\u044c\u0431\u043e\u0439 \u043e\u0442\u043a\u0438\u043d\u0443\u0442\u044c \u0432\u0441\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0434\u0435\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443, \u0441\u0443\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443:<\/p>\n<p>\u0415\u0441\u0442\u044c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0444\u0440\u043e\u043d\u0442\u0430 \u0438 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 API. \u0423 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0411\u0414 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0438 \u0441\u0442\u0430\u043b\u0430 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u043e \u0434\u0438\u0441\u043a\u043e\u043c\u0444\u043e\u0440\u0442, \u0430 \u043f\u043e\u0442\u043e\u043c \u0438 \u0432\u0441\u0435\u043e\u0431\u0449\u0443\u044e \u043f\u0430\u043d\u0438\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u00ab\u043f\u043b\u043e\u0445\u0438\u0445\u00bb 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0444\u0440\u043e\u043d\u0442 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0441\u0435\u0434\u0430\u0442\u044c \u0434\u043e \u00ab\u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445\u00bb 22-24 \u0441\u0435\u043a\u0443\u043d\u0434. \u041a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0435 \u0440\u0435\u0448\u0438\u0442\u044c, \u0442.\u043a. \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a API. \u041d\u0443\u0436\u043d\u043e \u0441\u0440\u043e\u0447\u043d\u043e \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u0447\u0451\u0442 \u0441 \u0446\u0438\u0444\u0440\u0430\u043c\u0438 \u0434\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u044f\u0441\u043d\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0443\u0432 \u043d\u0430 \u043a\u043e\u0434 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0438 \u043f\u0440\u043e\u0439\u0434\u044f \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">public interface UserService { Mono&lt;User> profileInfo(UUID userId);    \/\/ ... }<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/summary>\n<div class=\"spoiler__content\">\n<p><em>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0451 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438:<\/em><\/p>\n<pre><code class=\"java\">@Service public class UserServiceImpl implements UserService {  \/\/ ...  @Override public Mono&lt;User> profileInfo(UUID userId) {     final var user = User.builder().build();     return Mono.just(user).delayElement(Duration.ofMillis(12000)); }   @Override public Mono&lt;User> userInfo(UUID userId) {     final var user = User.builder().build();     return Mono.just(user).delayElement(Duration.ofMillis(5010)); }      \/\/ ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044d\u0442\u043e Webflux, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0432 \u0431\u0430\u0437\u0443 \u2014\u00a0 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u0435 sql \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0444\u0438\u0447\u0430 \u0442\u044f\u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u2014 \u0411\u0414, \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b\u2026 \u0415\u0449\u0451 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>\u041f\u043e \u0445\u043e\u0434\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u043e\u0434 \u043d\u0430\u0448 \u043a\u043e\u0434 \u0438\u043c\u0435\u044e\u0442\u0441\u044f:<\/p>\n<pre><code class=\"haskell\">@Test public void profileInfo() {     StepVerifier.create(userService.profileInfo(USER_ID)                         .log(\"profile-info\", Level.INFO, SignalType.ON_NEXT)             )                 .expectNextCount(1)                 .verifyComplete(); }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0442.\u043a. \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043c\u043e\u043a\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442. \u0411\u043b\u0430\u0433\u043e, \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 QA \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 curl \u043a\u0430\u043a \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0434\u0435\u0444\u0435\u043a\u0442.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043b\u043e\u0445\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u0446\u0438\u0444\u0440\u0430\u0445, \u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412 \u0438\u0434\u0435\u0430\u043b\u0435, \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u043e\u0432\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043d\u0438\u0432\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043d\u043e \u0438 \u0434\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u0441\u0440\u0430\u0437\u0443, \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u0442\u043e\u043f\u0432\u043e\u0442\u0447\u0430\u043c\u0438 \u043e\u0431\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043e, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u043f\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443.<\/p>\n<pre><code class=\"java\">@Test public void profileInfo_naivePerfomanceTest() { long startTime = System.currentTimeMillis(); StepVerifier.create(userService.profileInfo(USER_ID)                     .map(result -> {                     long finishTime = System.currentTimeMillis();                       System.out.printf(\"Start %d \\nEnd %d%n\", startTime, finishTime);                         return result;                 })                 .log(\"profile-info\", Level.INFO, SignalType.ON_NEXT)         )             .expectNextCount(1)             .verifyComplete(); }<\/code><\/pre>\n<p>\u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0435\u0442\u043e \u0438 \u043d\u0430 \u0445\u043e\u043b\u043e\u0434\u043d\u043e\u043c \u0441\u0442\u0430\u0440\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u044f\u0442\u044c \u0442\u043e\u0440\u043c\u043e\u0437\u0430? \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438 \u0442.\u0434. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\/\u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0442\u0435\u0441\u0442\u044b\/\u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 Java, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 JMH. \u0412 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u043d\u0451\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0438\u0437 JDK, \u043d\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.\u00a0<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u0438\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434? \u041d\u0435\u0443\u0436\u0435\u043b\u0438 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043b\u0438\u0431\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Webflux? \u0415\u0441\u0442\u044c reactor-test \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b. \u041c\u043e\u0436\u0435\u0442, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430?\u00a0<\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u043e\u0438\u0441\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u043d\u0435 \u0443\u0432\u0435\u043d\u0447\u0430\u043b\u0438\u0441\u044c \u0443\u0441\u043f\u0435\u0445\u043e\u043c. \u0422\u043e\u0433\u0434\u0430 \u0437\u0430\u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u0441\u043a\u0440\u0435\u0441\u0442\u0438\u0442\u044c reactor-test \u0438 JMH. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u0434 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u043a\u0430\u0442\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"java\">public interface UserService { @Deprecated \/**  * Use UserService.userInfo  *\/ Mono&lt;User> profileInfo(UUID userId); Mono&lt;User> userInfo(UUID userId); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043a\u043e\u0434\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 API \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0446\u0438\u0444\u0440\u0430\u0445, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0430\u0440\u044b \u0447\u0430\u0441\u043e\u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 JMH \u0438 Spring, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0430, \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 (\u0443\u0431\u0440\u0430\u043d\u044b \u043c\u043e\u043a\u0438 \u0438 \u043b\u0438\u0448\u043d\u0438\u0439 \u043a\u043e\u0434, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a):<\/p>\n<pre><code class=\"java\">package ru.usetech.portal.service.benchmark; import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.results.format.ResultFormatType; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.openjdk.jmh.runner.options.TimeValue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Profile; import reactor.test.StepVerifier; import ru.usetech.portal.service.UserService; import ru.usetech.portal.service.impl.UserServiceImpl; import java.util.UUID; import java.util.concurrent.TimeUnit; @Profile(\"local\") @State(Scope.Benchmark) @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) @SpringBootTest(classes = {     UserServiceImpl.class }) public class UserServicePerformanceTest { private static final UUID USER_ID = UUID.randomUUID(); \/\/ JMH isn't support autowired services private static UserService userService; \/\/ The @State annotation can only be applied to the classes having the default public constructor. @Autowired public void injectService(UserService userService) {         UserServicePerformanceTest.userService = userService; }   @Test public void start() throws RunnerException {     Options opts = new OptionsBuilder()             .warmupIterations(3)             .warmupTime(TimeValue.seconds(20))             .measurementIterations(3)             .measurementTime(TimeValue.seconds(20))             .forks(0) \/\/ use only for debug.             .threads(1)                 .shouldDoGC(true)                 .shouldFailOnError(true)                 .resultFormat(ResultFormatType.JSON)             .build();     new Runner(opts).run(); } @Benchmark public void profileInfo() {     StepVerifier.create(userService.profileInfo(USER_ID))                 .expectNextCount(1)                 .verifyComplete(); } @Benchmark public void profileInfoNew() {     StepVerifier.create(userService.userInfo(USER_ID))                 .expectNextCount(1)                 .verifyComplete(); } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432, \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b JMH, \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u0438 \u043f\u043e\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 @Benchmark. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0431\u044b\u043b\u043e \u0443\u0431\u0440\u0430\u043d\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u0430\u043c\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<details class=\"spoiler\">\n<summary>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils (file:\/home\/alexandr\/.m2\/repository\/org\/openjdk\/jmh\/jmh-core\/1.22\/jmh-core-1.22.jar) to field java.io.PrintStream.charOut WARNING: Please consider reporting this to the maintainers of org.openjdk.jmh.util.Utils WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release # JMH version: 1.22 # VM version: JDK 11.0.16, OpenJDK 64-Bit Server VM, 11.0.16+8-LTS # VM invoker: \/usr\/lib\/jvm\/zulu-11\/bin\/java # VM options: -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:\/usr\/share\/idea\/lib\/idea_rt.jar=38117:\/usr\/share\/idea\/bin -Dfile.encoding=UTF-8 # Warmup: 3 iterations, 20 s each # Measurement: 3 iterations, 20 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time\/op # Benchmark: ru.usetech.portal.service.benchmark.UserServicePerformanceTest.profileInfo   # Run progress: 0,00% complete, ETA 00:04:00 # Fork: N\/A, test runs in the host VM # *** WARNING: Non-forked runs may silently omit JVM options, mess up profilers, disable compiler hints, etc. *** # *** WARNING: Use non-forked runs only for debugging purposes, not for actual performance runs. *** # Warmup Iteration   1: 12042,567 ms\/op # Warmup Iteration   2: 12000,521 ms\/op # Warmup Iteration   3: 12000,538 ms\/op Iteration   1: 12000,406 ms\/op Iteration   2: 12000,493 ms\/op Iteration   3: 12000,438 ms\/op   Result \"ru.usetech.portal.service.benchmark.UserServicePerformanceTest.profileInfo\": 12000,446 \u00b1(99.9%) 0,810 ms\/op [Average] (min, avg, max) = (12000,406, 12000,446, 12000,493), stdev = 0,044 CI (99.9%): [11999,635, 12001,256] (assumes normal distribution)   # JMH version: 1.22 # VM version: JDK 11.0.16, OpenJDK 64-Bit Server VM, 11.0.16+8-LTS # VM invoker: \/usr\/lib\/jvm\/zulu-11\/bin\/java # VM options: -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:\/usr\/share\/idea\/lib\/idea_rt.jar=38117:\/usr\/share\/idea\/bin -Dfile.encoding=UTF-8 # Warmup: 3 iterations, 20 s each # Measurement: 3 iterations, 20 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time\/op # Benchmark: ru.usetech.portal.service.benchmark.UserServicePerformanceTest.profileInfoNew   # Run progress: 50,00% complete, ETA 00:02:28 # Fork: N\/A, test runs in the host VM # *** WARNING: Non-forked runs may silently omit JVM options, mess up profilers, disable compiler hints, etc. *** # *** WARNING: Use non-forked runs only for debugging purposes, not for actual performance runs. *** # Warmup Iteration   1: 5010,497 ms\/op # Warmup Iteration   2: 5010,426 ms\/op # Warmup Iteration   3: 5010,453 ms\/op Iteration   1: 5010,429 ms\/op Iteration   2: 5010,463 ms\/op Iteration   3: 5010,420 ms\/op   Result \"ru.usetech.portal.service.benchmark.UserServicePerformanceTest.profileInfoNew\": 5010,438 \u00b1(99.9%) 0,408 ms\/op [Average] (min, avg, max) = (5010,420, 5010,438, 5010,463), stdev = 0,022 CI (99.9%): [5010,030, 5010,845] (assumes normal distribution)  # Run complete. Total time: 00:04:32 REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial experiments, perform baseline and negative tests that provide experimental control, make sure the benchmarking environment is safe on JVM\/OS\/HW level, ask for reviews from the domain experts. Do not assume the numbers tell you what you want them to tell.   Benchmark                              Mode  Cnt      Score   Error  Units UserServicePerformanceTest.profileInfo avgt    3  12000,446 \u00b1 0,810  ms\/op UserServicePerformanceTest.profileInfoNew  avgt    3   5010,438 \u00b1 0,408  ms\/op Benchmark result is saved to jmh-result.json<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434:  <\/p>\n<pre><code class=\"java\">Benchmark                              Mode  Cnt      Score   Error  Units UserServicePerformanceTest.profileInfo avgt    3  12000,446 \u00b1 0,810  ms\/op UserServicePerformanceTest.profileInfoNew  avgt    3   5010,438 \u00b1 0,408  ms\/op Benchmark result is saved to jmh-result.json<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f \u043e\u0442\u0447\u0451\u0442 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/193\/553\/c5c\/193553c5cc97a3341c823af1dffb4496.png\" width=\"477\" height=\"409\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/193\/553\/c5c\/193553c5cc97a3341c823af1dffb4496.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0430 \u0438 \u0434\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u043d\u0430 \u0446\u0438\u0444\u0440\u0430\u0445, \u0430 \u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u0442\u0435\u043c \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0437\u0431\u043e\u0440\u0435 \u0437\u0430\u0434\u0430\u0447 \u043d\u0430 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 API.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u044b \u0441 \u043f\u0440\u0438\u043c\u0435\u043d\u0451\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0438\u043b\u0438 \u0434\u043b\u044f Webflux \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb, \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u0430\u0448\u0438\u043c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c \u2014 \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043d\u0430\u0432\u0435\u0440\u0441\u0442\u0430\u044e \u0443\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0435.<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u0440\u0435\u043c\u044f, \u0443\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439.\u00a0<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \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\/company\/usetech\/blog\/680948\/\"> https:\/\/habr.com\/ru\/company\/usetech\/blog\/680948\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div class=\"persona\" persona=\"true\">\n<h5 class=\"persona__heading\" persona=\"true\">\u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u041b\u0435\u043e\u043d\u043e\u0432<\/h5>\n<p>\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/p>\n<\/div>\n<p>\u0414\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 <a href=\"https:\/\/habr.com\/ru\/users\/venum\/\">\u0410\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440 \u041b\u0435\u043e\u043d\u043e\u0432<\/a>, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 Usetech. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u0440\u043c\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 Webflux. \u0421\u0442\u0430\u0442\u044c\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d\u0430 \u043d\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 API \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430. \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0451\u043c.<\/p>\n<details class=\"spoiler\">\n<summary>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/summary>\n<div class=\"spoiler__content\">\n<p><em>\u0412\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043d\u0438\u0436\u0435 \u043a\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c, \u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430.<\/em><\/p>\n<p><em>\u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432, \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0438\u0437\u043d\u0443\u0442\u0440\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0442\u043e\u043d\u043a\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043b\u044e\u0434\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043c\u043f\u0435\u0442\u0435\u043d\u0446\u0438\u0439!<\/em><\/p>\n<\/div>\n<\/details>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0434\u0435\u043d\u044c, \u0432 \u043b\u0441 \u0441\u0442\u0443\u0447\u0438\u0442\u0441\u044f \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0441 \u043f\u0440\u043e\u0441\u044c\u0431\u043e\u0439 \u043e\u0442\u043a\u0438\u043d\u0443\u0442\u044c \u0432\u0441\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u0434\u0435\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443, \u0441\u0443\u0442\u044c \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443:<\/p>\n<p>\u0415\u0441\u0442\u044c \u043a\u043e\u0440\u043f\u043e\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0440\u0442\u0430\u043b, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0444\u0440\u043e\u043d\u0442\u0430 \u0438 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 API. \u0423 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0441 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0411\u0414 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0421\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0438 \u0441\u0442\u0430\u043b\u0430 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u043b\u043e \u0434\u0438\u0441\u043a\u043e\u043c\u0444\u043e\u0440\u0442, \u0430 \u043f\u043e\u0442\u043e\u043c \u0438 \u0432\u0441\u0435\u043e\u0431\u0449\u0443\u044e \u043f\u0430\u043d\u0438\u043a\u0443, \u043a\u043e\u0433\u0434\u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u00ab\u043f\u043b\u043e\u0445\u0438\u0445\u00bb 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0444\u0440\u043e\u043d\u0442 \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e\u0441\u0435\u0434\u0430\u0442\u044c \u0434\u043e \u00ab\u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445\u00bb 22-24 \u0441\u0435\u043a\u0443\u043d\u0434. \u041a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0435 \u0440\u0435\u0448\u0438\u0442\u044c, \u0442.\u043a. \u0435\u0441\u0442\u044c \u043d\u0435\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a API. \u041d\u0443\u0436\u043d\u043e \u0441\u0440\u043e\u0447\u043d\u043e \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u0447\u0451\u0442 \u0441 \u0446\u0438\u0444\u0440\u0430\u043c\u0438 \u0434\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u043e\u0441\u043b\u0435.<\/p>\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u044f\u0441\u043d\u0430, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/p>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0443\u0432 \u043d\u0430 \u043a\u043e\u0434 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0438 \u043f\u0440\u043e\u0439\u0434\u044f \u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">public interface UserService { Mono&lt;User> profileInfo(UUID userId);    \/\/ ... }<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/summary>\n<div class=\"spoiler__content\">\n<p><em>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0432\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0451 \u0431\u044b\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0438:<\/em><\/p>\n<pre><code class=\"java\">@Service public class UserServiceImpl implements UserService {  \/\/ ...  @Override public Mono&lt;User> profileInfo(UUID userId) {     final var user = User.builder().build();     return Mono.just(user).delayElement(Duration.ofMillis(12000)); }   @Override public Mono&lt;User> userInfo(UUID userId) {     final var user = User.builder().build();     return Mono.just(user).delayElement(Duration.ofMillis(5010)); }      \/\/ ... }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044d\u0442\u043e Webflux, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0432 \u0431\u0430\u0437\u0443 \u2014\u00a0 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043b\u0430\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0433\u043e\u043d\u0435 sql \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0436\u0435 \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0444\u0438\u0447\u0430 \u0442\u044f\u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u2014 \u0411\u0414, \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b\u2026 \u0415\u0449\u0451 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>\u041f\u043e \u0445\u043e\u0434\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0435 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b \u043f\u043e\u0434 \u043d\u0430\u0448 \u043a\u043e\u0434 \u0438\u043c\u0435\u044e\u0442\u0441\u044f:<\/p>\n<pre><code class=\"haskell\">@Test public void profileInfo() {     StepVerifier.create(userService.profileInfo(USER_ID)                         .log(\"profile-info\", Level.INFO, SignalType.ON_NEXT)             )                 .expectNextCount(1)                 .verifyComplete(); }<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0442.\u043a. \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u043c\u043e\u043a\u043e\u0432 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0438 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u0442. \u0411\u043b\u0430\u0433\u043e, \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 QA \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 curl \u043a\u0430\u043a \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u0434\u0435\u0444\u0435\u043a\u0442.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043b\u043e\u0445\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u0446\u0438\u0444\u0440\u0430\u0445, \u043d\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412 \u0438\u0434\u0435\u0430\u043b\u0435, \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u043e\u0432\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043d\u0438\u0432\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043d\u043e \u0438 \u0434\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0431\u044d\u043a\u0435\u043d\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u0446\u0435\u043d\u043a\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0434\u0430 \u0441\u0440\u0430\u0437\u0443, \u043f\u043e\u0441\u043b\u0435 \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438 \u0441\u0442\u043e\u043f\u0432\u043e\u0442\u0447\u0430\u043c\u0438 \u043e\u0431\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043e, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u043f\u043e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u0442\u043e\u0442 \u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0443.<\/p>\n<pre><code class=\"java\">@Test public void profileInfo_naivePerfomanceTest() { long startTime = System.currentTimeMillis(); StepVerifier.create(userService.profileInfo(USER_ID)                     .map(result -> {                     long finishTime = System.currentTimeMillis();                       System.out.printf(\"Start %d \\nEnd %d%n\", startTime, finishTime);                         return result;                 })                 .log(\"profile-info\", Level.INFO, SignalType.ON_NEXT)         )             .expectNextCount(1)             .verifyComplete(); }<\/code><\/pre>\n<p>\u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0435\u0442\u043e \u0438 \u043d\u0430 \u0445\u043e\u043b\u043e\u0434\u043d\u043e\u043c \u0441\u0442\u0430\u0440\u0442\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u044f\u0442\u044c \u0442\u043e\u0440\u043c\u043e\u0437\u0430? \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u043e\u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438 \u0442.\u0434. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438\/\u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0442\u0435\u0441\u0442\u044b\/\u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0430 Java, \u0442\u043e \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 JMH. \u0412 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f \u043d\u0430 \u043d\u0451\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0438\u0437 JDK, \u043d\u043e \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043a\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u043b\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.\u00a0<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u0438\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u0434? \u041d\u0435\u0443\u0436\u0435\u043b\u0438 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043b\u0438\u0431\u044b \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f Webflux? \u0415\u0441\u0442\u044c reactor-test \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0442\u0435\u0441\u0442\u044b. \u041c\u043e\u0436\u0435\u0442, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430?\u00a0<\/p>\n<p>\u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043f\u043e\u0438\u0441\u043a\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u043d\u0435 \u0443\u0432\u0435\u043d\u0447\u0430\u043b\u0438\u0441\u044c \u0443\u0441\u043f\u0435\u0445\u043e\u043c. \u0422\u043e\u0433\u0434\u0430 \u0437\u0430\u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u0441\u043a\u0440\u0435\u0441\u0442\u0438\u0442\u044c reactor-test \u0438 JMH. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u043a\u043e\u0434 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u043a\u0430\u0442\u0430 \u043d\u0435 \u0431\u044b\u043b\u043e \u0431\u043e\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"java\">public interface UserService { @Deprecated \/**  * Use UserService.userInfo  *\/ Mono&lt;User> profileInfo(UUID userId); Mono&lt;User> userInfo(UUID userId); }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u043a\u043e\u0434\u0430 \u0432 \u043d\u043e\u0432\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u043e\u043d\u0430\u0445 \u0447\u0435\u0440\u0435\u0437 API \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0446\u0438\u0444\u0440\u0430\u0445, \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0430\u0440\u044b \u0447\u0430\u0441\u043e\u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0441\u043a\u0440\u0435\u0449\u0438\u0432\u0430\u043d\u0438\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0439 JMH \u0438 Spring, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0430, \u0431\u044b\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 (\u0443\u0431\u0440\u0430\u043d\u044b \u043c\u043e\u043a\u0438 \u0438 \u043b\u0438\u0448\u043d\u0438\u0439 \u043a\u043e\u0434, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a):<\/p>\n<pre><code class=\"java\">package ru.usetech.portal.service.benchmark; import org.junit.jupiter.api.Test; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.results.format.ResultFormatType; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.openjdk.jmh.runner.options.TimeValue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.annotation.Profile; import reactor.test.StepVerifier; import ru.usetech.portal.service.UserService; import ru.usetech.portal.service.impl.UserServiceImpl; import java.util.UUID; import java.util.concurrent.TimeUnit; @Profile(\"local\") @State(Scope.Benchmark) @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) @SpringBootTest(classes = {     UserServiceImpl.class }) public class UserServicePerformanceTest { private static final UUID USER_ID = UUID.randomUUID(); \/\/ JMH isn't support autowired services private static UserService userService; \/\/ The @State annotation can only be applied to the classes having the default public constructor. @Autowired public void injectService(UserService userService) {         UserServicePerformanceTest.userService = userService; }   @Test public void start() throws RunnerException {     Options opts = new OptionsBuilder()             .warmupIterations(3)             .warmupTime(TimeValue.seconds(20))             .measurementIterations(3)             .measurementTime(TimeValue.seconds(20))             .forks(0) \/\/ use only for debug.             .threads(1)                 .shouldDoGC(true)                 .shouldFailOnError(true)                 .resultFormat(ResultFormatType.JSON)             .build();     new Runner(opts).run(); } @Benchmark public void profileInfo() {     StepVerifier.create(userService.profileInfo(USER_ID))                 .expectNextCount(1)                 .verifyComplete(); } @Benchmark public void profileInfoNew() {     StepVerifier.create(userService.userInfo(USER_ID))                 .expectNextCount(1)                 .verifyComplete(); } }<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432, \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b JMH, \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u044e\u043d\u0438\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438 \u0438 \u043f\u043e\u0434 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434, \u0432\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 @Benchmark. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0431\u044b\u043b\u043e \u0443\u0431\u0440\u0430\u043d\u043e \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043f\u0430\u043c\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u044d\u0442\u043e\u0442 \u0442\u0435\u0441\u0442 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b:<\/p>\n<details class=\"spoiler\">\n<summary>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"java\">WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.openjdk.jmh.util.Utils (file:\/home\/alexandr\/.m2\/repository\/org\/openjdk\/jmh\/jmh-core\/1.22\/jmh-core-1.22.jar) to field java.io.PrintStream.charOut WARNING: Please consider reporting this to the maintainers of org.openjdk.jmh.util.Utils WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release # JMH version: 1.22 # VM version: JDK 11.0.16, OpenJDK 64-Bit Server VM, 11.0.16+8-LTS # VM invoker: \/usr\/lib\/jvm\/zulu-11\/bin\/java # VM options: -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:\/usr\/share\/idea\/lib\/idea_rt.jar=38117:\/usr\/share\/idea\/bin -Dfile.encoding=UTF-8 # Warmup: 3 iterations, 20 s each # Measurement: 3 iterations, 20 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time\/op # Benchmark: ru.usetech.portal.service.benchmark.UserServicePerformanceTest.profileInfo   # Run progress: 0,00% complete, ETA 00:04:00 # Fork: N\/A, test runs in the host VM # *** WARNING: Non-forked runs may silently omit JVM options, mess up profilers, disable compiler hints, etc. *** # *** WARNING: Use non-forked<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-336610","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336610","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=336610"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336610\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}