{"id":365352,"date":"2024-05-21T02:36:20","date_gmt":"2024-05-21T02:36:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=365352"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=365352","title":{"rendered":"<span>\u041a\u0430\u043a \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java 21 \u0438 \u043d\u0430 \u0440\u0430\u0437-\u0434\u0432\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0435\u0434\u043b\u043e\u043a \u0432 TPC-C \u0434\u043b\u044f PostgreSQL<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0418\u0432\u0430\u043d\u043e\u0432, \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/ydb.tech\">YDB<\/a>. \u041d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0412\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u043e\u0441\u0442 \u043d\u0435 \u043e YDB, \u0430 \u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 Java 21 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 TPC-C \u0434\u043b\u044f PostgreSQL.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/dp\/0q\/7m\/dp0q7mabdurvyux8zyx5hsh3b1q.jpeg\" alt=\"\u0414\u0435\u0434\u043b\u043e\u043a \u0443 \u043e\u0431\u0435\u0434\u0430\u044e\u0449\u0438\u0445 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u043e\u0432\" width=\"400\" data-src=\"https:\/\/habrastorage.org\/webt\/dp\/0q\/7m\/dp0q7mabdurvyux8zyx5hsh3b1q.jpeg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u0414\u0435\u0434\u043b\u043e\u043a \u0443 \u043e\u0431\u0435\u0434\u0430\u044e\u0449\u0438\u0445 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/companies\/ydb\/articles\/763938\/\">\u043f\u043e\u0441\u0442\u0435<\/a> \u043e TPC-C \u0434\u043b\u044f YDB, \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 TPC-C \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c <a href=\"https:\/\/github.com\/cmu-db\/benchbase\">Benchbase<\/a> (\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442). \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043d\u0430 \u043d\u0430\u0448 \u0432\u0437\u0433\u043b\u044f\u0434, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (concurrency limit) \u0438\u0437-\u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java\u00a021. \u041d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0441\u044b\u0440 \u0431\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u044b\u0448\u0435\u043b\u043e\u0432\u043a\u0435. \u0418 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u0434\u043b\u043e\u043a\u0430 \u0432 TPC-C \u0434\u043b\u044f PostgreSQL, \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 &#8212; \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0431\u0435\u0434\u0430\u044e\u0449\u0438\u0445 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u043e\u0432.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d Java \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u043a\u0430\u043a \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0410 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0430\u0436\u043d\u0443\u044e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432: \u0434\u0435\u0434\u043b\u043e\u043a\u0438 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b \u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430 \u0438 \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0434\u0435\u0434\u043b\u043e\u043a\u0438.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e PostgreSQL \u0432 \u0431\u043b\u043e\u0433\u0435 YDB<\/h3>\n<p>PostgreSQL \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0441\u0432\u043e\u0435\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0431\u043e\u0433\u0430\u0442\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 SQL. \u0427\u0442\u043e \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u043e, \u0432\u043e\u043a\u0440\u0443\u0433 PostgreSQL \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0438 \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e. \u041d\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u043a\u0430 \u0432\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c. \u0422\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 Postgres \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Citus. \u041f\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u0438\u043c \u0441\u043b\u043e\u043d\u043e\u043c \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0446\u0435\u043b\u043e\u0435 \u0441\u0442\u0430\u0434\u043e \u0441\u043b\u043e\u043d\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0441\u043b\u043e\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043f\u043b\u0438\u043a \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 &#171;serializable&#187;.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ua\/sx\/zp\/uasxzpvgafysqk4fcdhftfpunfa.png\" width=\"400\" data-src=\"https:\/\/habrastorage.org\/webt\/ua\/sx\/zp\/uasxzpvgafysqk4fcdhftfpunfa.png\"\/><\/figure>\n<p>YDB \u0436\u0435 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0421\u0423\u0411\u0414. \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 YDB \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e YDB (first-class citizens) \u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 &#171;serializable&#187;. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u043c\u0441\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441 PostgreSQL, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0438\u0434\u0438\u043c \u0441\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0440\u043e\u0441 \u0441\u0440\u0435\u0434\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 PostgreSQL \u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c <a href=\"https:\/\/github.com\/ydb-platform\/tpcc\">TPC-C \u0434\u043b\u044f PostgreSQL<\/a> (\u0438 \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u043e \u043d\u0430\u0448\u0438 \u043f\u0430\u0442\u0447\u0438 \u043f\u0440\u0438\u043c\u0443\u0442 \u0432 Benchbase).<\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u044b \u0438 \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0435 (concurrent) \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0438 \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0443 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c, \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c (\u0432 \u0442.\u0447. \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 IDE \u0438 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0432 telegram. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044f\u0441\u044c \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438. \u0418\u043b\u0438 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0433\u0443\u043b\u044f\u0442\u044c \u0441 \u0441\u043e\u0431\u0430\u043a\u043e\u0439 \u0438 \u0440\u0430\u0437\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443 &#8212; \u0442\u043e\u0433\u0434\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e \u0441\u0435\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0421\u0423\u0411\u0414, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043e\u0442\u0432\u0435\u0442. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043a\u0440\u0443\u0433 \u043f\u043e \u0441\u0435\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u043e\u0439 \u0434\u043e\u043b\u0433\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u0427\u0442\u043e \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u0436\u0434\u0451\u0442 \u043e\u0442\u0432\u0435\u0442\u0430?<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439, \u043e\u043d \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u0438\u0441\u0430\u0442\u044c: \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 1 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 2 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">String userName = get_username_from_db(userId); System.out.printf(\"Hello, %s!\", userName); <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c. \u0422\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f, \u043f\u043e\u043a\u0430  \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">CompletableFuture&lt;String> userNameFuture = get_username_from_db(userId);  \/\/ Note, that this is kind of callback, it's not executed \"right here\", \/\/ even more, at some point it will be executed in parallel with your thread. \/\/ In real life scenarios, you will have to use mutual exclusion. userNameFuture.thenAccept(userName -> {     System.out.println(\"Hello, %s!\", userName); });  execute_something_else();  userNameFuture.get(); \/\/ wait for the completion of your request <\/code><\/pre>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u0435 (concurrent) \u0437\u0430\u0434\u0430\u0447\u0438: \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0421\u0423\u0411\u0414. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043e\u043a \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0442\u044b\u0441\u044f\u0447\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0431\u0430\u0437\u0435? \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e \u043f\u043e\u0442\u043e\u043a\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 Linux \u0434\u0451\u0448\u0435\u0432\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u044b, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u043d\u0443\u0436\u0435\u043d \u0441\u0442\u0435\u043a. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0432\u0430\u0448\u0435\u0439 \u041e\u0421, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 4 KiB \u0438\u043b\u0438 2 MiB \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (huge pages).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 Linux. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c 100 000 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044c\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430 &#171;reset&#187;.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e Java\u00a021 \u0431\u044b\u043b\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Go \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044f: \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0443\u044e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c (lightweight concurrency), \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 <em>\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e<\/em>. \u041c\u044b \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/youtu.be\/-K11rY57K7k?si=XT8mkXL2ypmVj4ig\">\u0434\u043e\u043a\u043b\u0430\u0434<\/a> \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0412\u044c\u044e\u043a\u043e\u0432\u0430 \u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 Go. Java\u00a021 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043d\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u043d\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u0435\u043c, \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0440\u0435\u0438\u043d\u043a\u0430\u0440\u043d\u0430\u0446\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 (user-level threads).<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0432 TPC-C \u043e\u0442 Benchbase. \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0421\u0423\u0411\u0414, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u043a\u043b\u0430\u0434\u043e\u0432 TPC-C, \u0441\u043e\u0437\u0434\u0430\u0432 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0423 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 30 000 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432-\u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u041d\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432-\u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<h3>\u0414\u0435\u0434\u043b\u043e\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437-\u0434\u0432\u0430<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Java. \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0430\u0434\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u0438, \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0431\u0435\u0437 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u0412\u043e\u0442 <a href=\"https:\/\/github.com\/ydb-platform\/tpcc\/blob\/c8474bc7cf40456de0fe4c7fb060d867dd985ede\/src\/main\/java\/com\/oltpbenchmark\/ThreadBench.java#L65-L69\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a> \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 TPC-C:<\/p>\n<pre><code class=\"java\">if (useRealThreads) {     thread = new Thread(worker); } else {     thread = Thread.ofVirtual().unstarted(worker); } <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 Java \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u043b <em>\u043f\u043e\u0442\u043e\u043a\u043e\u0432-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u0439 (carrier threads)<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 <em>\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (virtual threads)<\/em>. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439, \u043d\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u0435\u0442.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/mo\/1z\/hd\/mo1zhdt_htf1qmz_lqol-g_imio.png\" width=\"400\" data-src=\"https:\/\/habrastorage.org\/webt\/mo\/1z\/hd\/mo1zhdt_htf1qmz_lqol-g_imio.png\"\/><\/figure>\n<p>\u041d\u0430\u0448\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f TPC-C \u0434\u043b\u044f PostgreSQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 <a href=\"https:\/\/www.mchange.com\/projects\/c3p0\/\">c3p0<\/a>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/www.tpc.org\/tpcc\/\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 TPC-C<\/a> \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u043f\u0446\u0438\u044e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0441 \u0421\u0423\u0411\u0414. \u0427\u0438\u0441\u043b\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0442.\u0435. \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435).<\/p>\n<p>\u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 TPC-C \u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0437\u0430\u0432\u0438\u0441. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0434\u0435\u0431\u0430\u0436\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u0442\u0435\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>jstack &lt;PID><\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u0430\u043c\u043f \u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0442\u043e\u043a\u0430\u0445-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f\u0445 \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>jcmd &lt;PID> Thread.dump_to_file -format=text jcmd.dump.1<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c \u0438 \u043d\u0435 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u0435\u0433\u043e. \u0412\u043e\u0442 \u0441\u0442\u0435\u043a \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430:<\/p>\n<pre><code>#7284 \"TPCCWorker&lt;7185>\" virtual       java.base\/java.lang.Object.wait0(Native Method)       java.base\/java.lang.Object.wait(Object.java:366)       com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1503)       com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)       com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)       com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)       com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)       com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)       com.oltpbenchmark.api.BenchmarkModule.makeConnection(BenchmarkModule.java:108)       com.oltpbenchmark.api.Worker.doWork(Worker.java:428)       com.oltpbenchmark.api.Worker.run(Worker.java:304)       java.base\/java.lang.VirtualThread.run(VirtualThread.java:309)  <\/code><\/pre>\n<p>\u0438 \u0441\u0442\u0435\u043a \u043f\u043e\u0442\u043e\u043a\u0430-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f:<\/p>\n<pre><code>\"ForkJoinPool-1-worker-254\" #50326 [32859] daemon prio=5 os_prio=0 cpu=12.39ms elapsed=489.99s tid=0x00007f3810003140  [0x00007f37abafe000]    Carrying virtual thread #7284         at jdk.internal.vm.Continuation.run(java.base@21.0.1\/Continuation.java:251)         at java.lang.VirtualThread.runContinuation(java.base@21.0.1\/VirtualThread.java:221)         at java.lang.VirtualThread$$Lambda\/0x00007f3c2424e410.run(java.base@21.0.1\/Unknown Source)         at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(java.base@21.0.1\/ForkJoinTask.java:1423)         at java.util.concurrent.ForkJoinTask.doExec(java.base@21.0.1\/ForkJoinTask.java:387)         at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base@21.0.1\/ForkJoinPool.java:1312)         at java.util.concurrent.ForkJoinPool.scan(java.base@21.0.1\/ForkJoinPool.java:1843)         at java.util.concurrent.ForkJoinPool.runWorker(java.base@21.0.1\/ForkJoinPool.java:1808)         at java.util.concurrent.ForkJoinWorkerThread.run(java.base@21.0.1\/ForkJoinWorkerThread.java:188) <\/code><\/pre>\n<p>\u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0432\u044b\u0437\u043e\u0432\u0435 <code>Object.wait()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <code>synchronized<\/code>. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0438, \u0432\u043b\u0430\u0434\u0435\u044e\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0441 \u0431\u0430\u0437\u043e\u0439, \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a\u0438-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0438, \u0442.\u043a. \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0432\u0432\u043e\u0434-\u0432\u044b\u0432\u043e\u0434:<\/p>\n<pre><code>      java.base\/java.lang.VirtualThread.park(VirtualThread.java:582)       java.base\/java.lang.System$2.parkVirtualThread(System.java:2639)       java.base\/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:54)       java.base\/java.util.concurrent.locks.LockSupport.park(LockSupport.java:369)       java.base\/sun.nio.ch.Poller.pollIndirect(Poller.java:139)       java.base\/sun.nio.ch.Poller.poll(Poller.java:102)       java.base\/sun.nio.ch.Poller.poll(Poller.java:87)       java.base\/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:175)       java.base\/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:201)       java.base\/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)       java.base\/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:346)       java.base\/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:796)       java.base\/java.net.Socket$SocketInputStream.read(Socket.java:1099)       java.base\/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:489)       java.base\/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:483)       java.base\/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)       java.base\/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1461)       java.base\/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1066)       org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161)       org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:128)       org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:113)       org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73)       org.postgresql.core.PGStream.receiveChar(PGStream.java:465)       org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2155)       org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:574)       org.postgresql.jdbc.PgStatement.internalExecuteBatch(PgStatement.java:896)       org.postgresql.jdbc.PgStatement.executeBatch(PgStatement.java:919)       org.postgresql.jdbc.PgPreparedStatement.executeBatch(PgPreparedStatement.java:1685)       com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2544)       com.oltpbenchmark.benchmarks.tpcc.procedures.NewOrder.newOrderTransaction(NewOrder.java:214)       com.oltpbenchmark.benchmarks.tpcc.procedures.NewOrder.run(NewOrder.java:147)       com.oltpbenchmark.benchmarks.tpcc.TPCCWorker.executeWork(TPCCWorker.java:66)       com.oltpbenchmark.api.Worker.doWork(Worker.java:442)       com.oltpbenchmark.api.Worker.run(Worker.java:304)       java.base\/java.lang.VirtualThread.run(VirtualThread.java:309) <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438:<\/p>\n<ol>\n<li>\n<p>\u0410\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432\u0441\u0435 \u043f\u043e\u0442\u043e\u043a\u0438-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0438 \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u044b \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438, \u0432\u043b\u0430\u0434\u0435\u044e\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0441 \u0431\u0430\u0437\u043e\u0439, \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0441\u0435\u0441\u0441\u0438\u044e, \u0442.\u043a. \u043d\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u0435\u0434\u043b\u043e\u043a \u043d\u0430 \u0440\u0430\u0437-\u0434\u0432\u0430!<\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/openjdk.org\/jeps\/444\">JEP 444<\/a>:<\/p>\n<blockquote>\n<p>There are two scenarios in which a virtual thread cannot be unmounted during blocking operations because it is pinned to its carrier:<\/p>\n<p>When it executes code inside a synchronized block or method, or<br \/> When it executes a native method or a foreign function.<\/p>\n<\/blockquote>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u043e\u0434 \u0441 <code>synchronized<\/code> \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e c3p0. <a href=\"https:\/\/github.com\/ydb-platform\/tpcc\/commit\/175f0c03d9c16652c85a6103331fec473017797e\">\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/a> \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435: \u043c\u044b \u043e\u0431\u0435\u0440\u043d\u0443\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0432 <code>java.util.concurrent.Semaphore<\/code>. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u0435, \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u044f \u043f\u043e\u0442\u043e\u043a-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c, \u0430 \u0432\u043d\u0443\u0442\u0440\u044c c3p0 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/w1\/lg\/fk\/w1lgfkdxqsvjsqejwku_jhbxohs.jpeg\" alt=\"\u041e\u0431\u043b\u043e\u0436\u043a\u0430 \u043a\u043d\u0438\u0433\u0438 \u0424\u0440\u0435\u0434\u0430 \u0411\u0440\u0443\u043a\u0441\u0430 &quot;\u041c\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c\u0435\u0441\u044f\u0446&quot;. \u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043e\u0431\u043b\u043e\u0436\u043a\u0443 \u043a\u043d\u0438\u0433\u0438 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0438\u0437\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443 Addison-Wesley \u0438\u043b\u0438 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0443-\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443\" width=\"200\" data-src=\"https:\/\/habrastorage.org\/webt\/w1\/lg\/fk\/w1lgfkdxqsvjsqejwku_jhbxohs.jpeg\" data-blurred=\"true\"\/><\/p>\n<div><figcaption>\u041e\u0431\u043b\u043e\u0436\u043a\u0430 \u043a\u043d\u0438\u0433\u0438 \u0424\u0440\u0435\u0434\u0430 \u0411\u0440\u0443\u043a\u0441\u0430 &#171;\u041c\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u043c\u0435\u0441\u044f\u0446&#187;. \u0410\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043e\u0431\u043b\u043e\u0436\u043a\u0443 \u043a\u043d\u0438\u0433\u0438 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0438\u0437\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443 Addison-Wesley \u0438\u043b\u0438 \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0443-\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u041f\u041e, <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%B5%D1%80%D0%B5%D0%B1%D1%80%D1%8F%D0%BD%D0%BE%D0%B9_%D0%BF%D1%83%D0%BB%D0%B8_%D0%BD%D0%B5%D1%82\">\u0441\u0435\u0440\u0435\u0431\u0440\u044f\u043d\u043e\u0439 \u043f\u0443\u043b\u0438<\/a> \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java 21 &#8212; \u0437\u043d\u0430\u0447\u0438\u043c\u0430\u044f \u0444\u0438\u0447\u0430, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u043c. \u041d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u044d\u0442\u0443 \u0444\u0438\u0447\u0443 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e \u0438 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/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\/articles\/786550\/\"> https:\/\/habr.com\/ru\/articles\/786550\/<\/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<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0445\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0418\u0432\u0430\u043d\u043e\u0432, \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a <a href=\"https:\/\/ydb.tech\">YDB<\/a>. \u041d\u043e \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0412\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u043e\u0441\u0442 \u043d\u0435 \u043e YDB, \u0430 \u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 Java 21 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 TPC-C \u0434\u043b\u044f PostgreSQL.<\/p>\n<figure class=\"\">\n<div><figcaption>\u0414\u0435\u0434\u043b\u043e\u043a \u0443 \u043e\u0431\u0435\u0434\u0430\u044e\u0449\u0438\u0445 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/companies\/ydb\/articles\/763938\/\">\u043f\u043e\u0441\u0442\u0435<\/a> \u043e TPC-C \u0434\u043b\u044f YDB, \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 TPC-C \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c <a href=\"https:\/\/github.com\/cmu-db\/benchbase\">Benchbase<\/a> (\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442). \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0445 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432, \u043d\u0430 \u043d\u0430\u0448 \u0432\u0437\u0433\u043b\u044f\u0434, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (concurrency limit) \u0438\u0437-\u0437\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java\u00a021. \u041d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0441\u044b\u0440 \u0431\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u044b\u0448\u0435\u043b\u043e\u0432\u043a\u0435. \u0418 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c \u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u0435\u0434\u043b\u043e\u043a\u0430 \u0432 TPC-C \u0434\u043b\u044f PostgreSQL, \u043f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 &#8212; \u0438 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043e\u0431\u0435\u0434\u0430\u044e\u0449\u0438\u0445 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u043e\u0432.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0441\u0442 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u0435\u043d Java \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e\u0442 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u043a\u0440\u0430\u0442\u043a\u043e \u043e\u0431\u0441\u0443\u0434\u0438\u043c \u0442\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u043a\u0430\u043a \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0410 \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0430\u0436\u043d\u0443\u044e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432: \u0434\u0435\u0434\u043b\u043e\u043a\u0438 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b \u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430 \u0438 \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0434\u0435\u0434\u043b\u043e\u043a\u0438.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e PostgreSQL \u0432 \u0431\u043b\u043e\u0433\u0435 YDB<\/h3>\n<p>PostgreSQL \u2014 \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0441\u0432\u043e\u0435\u0439 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u0431\u043e\u0433\u0430\u0442\u044b\u043c \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 SQL. \u0427\u0442\u043e \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0432\u0430\u0436\u043d\u043e, \u0432\u043e\u043a\u0440\u0443\u0433 PostgreSQL \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0438 \u043e\u0442\u0437\u044b\u0432\u0447\u0438\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e. \u041d\u043e \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u043a\u0430 \u0432\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u044c. \u0422\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 Postgres \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a Citus. \u041f\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u0438\u043c \u0441\u043b\u043e\u043d\u043e\u043c \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0446\u0435\u043b\u043e\u0435 \u0441\u0442\u0430\u0434\u043e \u0441\u043b\u043e\u043d\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0441\u043b\u043e\u043d\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043f\u043b\u0438\u043a \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 &#171;serializable&#187;.<\/p>\n<figure class=\"\"><\/figure>\n<p>YDB \u0436\u0435 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u0421\u0423\u0411\u0414. \u0420\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 YDB \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e YDB (first-class citizens) \u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 &#171;serializable&#187;. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u043c\u0441\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441 PostgreSQL, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432\u0438\u0434\u0438\u043c \u0441\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u0440\u043e\u0441 \u0441\u0440\u0435\u0434\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 PostgreSQL \u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c <a href=\"https:\/\/github.com\/ydb-platform\/tpcc\">TPC-C \u0434\u043b\u044f PostgreSQL<\/a> (\u0438 \u043d\u0430\u0434\u0435\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u043e \u043d\u0430\u0448\u0438 \u043f\u0430\u0442\u0447\u0438 \u043f\u0440\u0438\u043c\u0443\u0442 \u0432 Benchbase).<\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u044b \u0438 \u043c\u043e\u0442\u0438\u0432\u0430\u0446\u0438\u044f<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0435 (concurrent) \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u0438 \u043a\u0430\u043a\u0438\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0443 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c, \u0442\u0430\u043a \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c (\u0432 \u0442.\u0447. \u043f\u043e\u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u043c). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 IDE \u0438 \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c\u0438 \u0432 telegram. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 \u044d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u044f\u0441\u044c \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430 \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438. \u0418\u043b\u0438 \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0433\u0443\u043b\u044f\u0442\u044c \u0441 \u0441\u043e\u0431\u0430\u043a\u043e\u0439 \u0438 \u0440\u0430\u0437\u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443 &#8212; \u0442\u043e\u0433\u0434\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e \u0441\u0435\u0442\u0438, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0421\u0423\u0411\u0414, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043e\u0442\u0432\u0435\u0442. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043a\u0440\u0443\u0433 \u043f\u043e \u0441\u0435\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u043e\u0439 \u0434\u043e\u043b\u0433\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434. \u0427\u0442\u043e \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0435\u043b\u0430\u0435\u0442, \u043f\u043e\u043a\u0430 \u0436\u0434\u0451\u0442 \u043e\u0442\u0432\u0435\u0442\u0430?<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439, \u043e\u043d \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u043f\u0438\u0441\u0430\u0442\u044c: \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 1 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 2 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">String userName = get_username_from_db(userId); System.out.printf(\"Hello, %s!\", userName); <\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c. \u0422\u043e\u0433\u0434\u0430 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f, \u043f\u043e\u043a\u0430  \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"java\">CompletableFuture&lt;String> userNameFuture = get_username_from_db(userId);  \/\/ Note, that this is kind of callback, it's not executed \"right here\", \/\/ even more, at some point it will be executed in parallel with your thread. \/\/ In real life scenarios, you will have to use mutual exclusion. userNameFuture.thenAccept(userName -> {     System.out.println(\"Hello, %s!\", userName); });  execute_something_else();  userNameFuture.get(); \/\/ wait for the completion of your request <\/code><\/pre>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u0435 (concurrent) \u0437\u0430\u0434\u0430\u0447\u0438: \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0421\u0423\u0411\u0414. \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043e\u043a \u0432 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0442\u044b\u0441\u044f\u0447\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0431\u0430\u0437\u0435? \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e \u043f\u043e\u0442\u043e\u043a\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 Linux \u0434\u0451\u0448\u0435\u0432\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u044b, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u041a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u043d\u0443\u0436\u0435\u043d \u0441\u0442\u0435\u043a. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0432\u0430\u0448\u0435\u0439 \u041e\u0421, \u0447\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 4 KiB \u0438\u043b\u0438 2 MiB \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 (huge pages).<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0439\u0442\u0435 \u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 Linux. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c 100 000 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044c\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0430 &#171;reset&#187;.<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e Java\u00a021 \u0431\u044b\u043b\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u044c\u044e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f: \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f Go \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u044f: \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0443\u044e \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c (lightweight concurrency), \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 <em>\u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e<\/em>. \u041c\u044b \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/youtu.be\/-K11rY57K7k?si=XT8mkXL2ypmVj4ig\">\u0434\u043e\u043a\u043b\u0430\u0434<\/a> \u0414\u043c\u0438\u0442\u0440\u0438\u044f \u0412\u044c\u044e\u043a\u043e\u0432\u0430 \u043e \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 Go. Java\u00a021 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u043d\u0438 \u0433\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u043d\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u0435\u043c, \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0440\u0435\u0438\u043d\u043a\u0430\u0440\u043d\u0430\u0446\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 (user-level threads).<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0432 TPC-C \u043e\u0442 Benchbase. \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0421\u0423\u0411\u0414, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0441\u043a\u043b\u0430\u0434\u043e\u0432 TPC-C, \u0441\u043e\u0437\u0434\u0430\u0432 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0423 \u043d\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 30 000 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432-\u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u041d\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432-\u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<h3>\u0414\u0435\u0434\u043b\u043e\u043a\u0438 \u043d\u0430 \u0440\u0430\u0437-\u0434\u0432\u0430<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 Java. \u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u041d\u0430\u0434\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043a\u043e\u0434\u0430, \u0433\u0434\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u0442\u043e\u043a\u0438, \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0442\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u0431\u0435\u0437 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438. \u0412\u043e\u0442 <a href=\"https:\/\/github.com\/ydb-platform\/tpcc\/blob\/c8474bc7cf40456de0fe4c7fb060d867dd985ede\/src\/main\/java\/com\/oltpbenchmark\/ThreadBench.java#L65-L69\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a> \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 TPC-C:<\/p>\n<pre><code class=\"java\">if (useRealThreads) {     thread = new Thread(worker); } else {     thread = Thread.ofVirtual().unstarted(worker); } <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438 \u0432\u0441\u0451, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438. \u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0448\u0438\u043d\u0430 Java \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u043b <em>\u043f\u043e\u0442\u043e\u043a\u043e\u0432-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u0439 (carrier threads)<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 <em>\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (virtual threads)<\/em>. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u0435\u0439, \u043d\u043e \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e \u0437\u0430\u0432\u0438\u0441\u0430\u0435\u0442.<\/p>\n<figure class=\"\"><\/figure>\n<p>\u041d\u0430\u0448\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f TPC-C \u0434\u043b\u044f PostgreSQL \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 <a href=\"https:\/\/www.mchange.com\/projects\/c3p0\/\">c3p0<\/a>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/www.tpc.org\/tpcc\/\">\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 TPC-C<\/a> \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u044d\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u043f\u0446\u0438\u044e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0441 \u0421\u0423\u0411\u0414. \u0427\u0438\u0441\u043b\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u043e\u0432 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0438\u0441\u043b\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u0441 \u0421\u0423\u0411\u0414, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u0442.\u0435. \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435).<\/p>\n<p>\u041c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 TPC-C \u0438 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a \u0437\u0430\u0432\u0438\u0441. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0434\u0435\u0431\u0430\u0436\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u0442\u0435\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>jstack &lt;PID><\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0434\u0430\u043c\u043f \u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u0442\u043e\u043a\u0430\u0445-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f\u0445 \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>jcmd &lt;PID> Thread.dump_to_file -format=text jcmd.dump.1<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438, \u043e\u0436\u0438\u0434\u0430\u044e\u0449\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0442\u043e\u043a-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c \u0438 \u043d\u0435 \u043e\u0442\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u0435\u0433\u043e. \u0412\u043e\u0442 \u0441\u0442\u0435\u043a \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430:<\/p>\n<pre><code>#7284 \"TPCCWorker&lt;7185>\" virtual       java.base\/java.lang.Object.wait0(Native Method)       java.base\/java.lang.Object.wait(Object.java:366)       com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1503)       com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)       com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)       com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)       com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)       com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)       com.oltpbenchmark.api.BenchmarkModule.makeConnection(BenchmarkModule.java:108)       com.oltpbenchmark.api.Worker.doWork(Worker.java:428)       com.oltpbenchmark.api.Worker.run(Worker.java:304)       java.base\/java.lang.VirtualThread.run(VirtualThread.java:309)  <\/code><\/pre>\n<p>\u0438 \u0441\u0442\u0435\u043a \u043f\u043e\u0442\u043e\u043a\u0430-\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044f:<\/p>\n<pre><code>\"ForkJoinPool-1-worker-254\" #50326 [32859] daemon prio=5 os_prio=0 cpu=12.39ms elapsed=489.99s tid=0x00007f3810003140  [0x00007f37abafe000]    Carrying virtual thread #7284         at jdk.internal.vm.Continuation.run(java.base@21.0.1\/Continuation.java:251)         at java.lang.VirtualThread.runContinuation(java.base@21.0.1\/VirtualThread.java:221)         at java.lang.VirtualThread$$Lambda\/0x00007f3c2424e410.run(java.base@21.0.1\/Unknown Source)         at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(java.base@21.0.1\/ForkJoinTask.java:1423)         at java.util.concurrent.ForkJoinTask.doExec(java.base@21.0.1\/ForkJoinTask.java:387)         at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base@21.0.1\/ForkJoinPool.java:1312)         at java.util.concurrent.ForkJoinPool.scan(java.base@21.0.1\/ForkJoinPool.java:1843)         at java.util.concurrent.ForkJoinPool.runWorker(java.base@21.0.1\/ForkJoinPool.java:1808)         at<\/code><\/pre>\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-365352","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365352","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=365352"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365352\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=365352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=365352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=365352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}