{"id":341216,"date":"2022-11-14T15:00:52","date_gmt":"2022-11-14T15:00:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=341216"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=341216","title":{"rendered":"<span>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Project Loom \u0432 Java<\/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>\u042d\u0442\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 Project Loom \u0432 Java \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (\u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u00abfibers\u00bb) \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb.<\/p>\n<h3>\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Project Loom<\/h3>\n<p>\u041f\u044b\u0442\u0430\u044f\u0441\u044c \u043e\u0441\u0432\u043e\u0438\u0442\u044c\u00a0<a href=\"https:\/\/jdk.java.net\/19\" rel=\"noopener noreferrer nofollow\">Project Loom \u0434\u043b\u044f Java 19<\/a>, \u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=EVZnk1ZyYeQ\" rel=\"noopener noreferrer nofollow\">\u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u041d\u0438\u043a\u043e\u043b\u0430\u044f \u041f\u0430\u0440\u043b\u043e\u0433\u0430<\/a>\u00a0\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u00a0<a href=\"https:\/\/developer.okta.com\/blog\/2022\/08\/26\/state-of-java-project-loom\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u0432\u00a0<\/a><a href=\"https:\/\/medium.com\/javarevisited\/how-i-spun-up-5-million-virtual-threads-without-stalling-the-jvm-1188d806e6bd\" rel=\"noopener noreferrer nofollow\">\u0431\u043b\u043e\u0433\u0435<\/a>.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u043d\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438, \u043a\u0430\u043a\u00a0<code>virtual threads<\/code> (\u0438\u043b\u0438\u00a0<code>fibers<\/code>) \u043c\u043e\u0433\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0441\u043e\u0442\u0435\u043d \u0442\u044b\u0441\u044f\u0447 \u0438\u043b\u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 Java-\u043f\u043e\u0442\u043e\u043a\u0438, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u041e\u0421, \u043c\u043e\u0433\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e \u043f\u0430\u0440\u044b \u0442\u044b\u0441\u044f\u0447 (TBD: \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443 \u043e \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u041e\u0421 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445). <\/p>\n<pre><code class=\"java\">try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {     IntStream.range(0, 100_000).forEach(i -> executor.submit(() -> {  \/\/ (1)         Thread.sleep(Duration.ofSeconds(1));         System.out.println(i);         return i;     })); }<\/code><\/pre>\n<ol>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 \u0431\u043b\u043e\u0433\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043f\u0430\u0442\u044c 100 000 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0441\u043f\u044f\u0449\u0438\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 &#8212; \u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e.\u00a0\u041d\u043e \u043c\u043e\u0433\u0443 \u043b\u0438 \u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c 100 000 HTTP-\u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432?<\/p>\n<pre><code class=\"java\">\/\/ \u043a\u0430\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430?  for (int i = 0; i &lt; 1000000; i++) {     \/\/ good, old Java Threads     new Thread( getURL(\"https:\/\/www.marcobehler.com\"))         .start(); }   for (int i = 0; i &lt; 1000000; i++) {     \/\/ \u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java 19 \u0441\u043f\u0435\u0448\u0430\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c?     Thread.startVirtualThread(() -> getURL(\"https:\/\/www.marcobehler.com\"))         .start(); }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439 \u0432\u044b\u044f\u0441\u043d\u0438\u043c.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Java \u0432\u044b\u0437\u043e\u0432\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f?<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u00a0<code>getURL<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 URL-\u0430\u0434\u0440\u0435\u0441 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<pre><code class=\"java\">static String getURL(String url) {     try (InputStream in = new URL(url).openStream()) {         byte[] bytes = in.readAllBytes(); \/\/ ALERT, ALERT!         return new String(bytes);     } catch (IOException e) {         throw new RuntimeException(e);     } }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0435 JavaDoc \u043f\u0440\u043e <code>inputStream.readAllBytes()<\/code> \u0438\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u0432\u0435\u0437\u043b\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u0443\u0440\u0441 Java 101, \u0432\u0430\u043c \u0432\u0434\u0430\u043b\u0431\u043b\u0438\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u044b \u0432\u0441\u0435 \u0431\u0430\u0439\u0442\u044b, \u0442.\u0435. \u0432\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u043c\u043e\u0433\u0443 \u044f\u043a\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0440\u0430\u0437 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043d\u043e \u043d\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432?<\/p>\n<p>\u0427\u0430\u0441\u0442\u0438 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438 \u2014 \u0442\u0435\u043c\u044b, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u043d\u0430\u043b\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0441\u043b\u0435 CS 101: Sockets &amp; Syscalls.<\/p>\n<h3>\u0421\u043e\u043a\u0435\u0442\u044b<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c HTTP-\u0432\u044b\u0437\u043e\u0432 \u0438\u043b\u0438, \u0441\u043a\u043e\u0440\u0435\u0435, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u0432\u044b (\u0438\u043b\u0438, \u0441\u043a\u043e\u0440\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435) \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0435\u00a0<em>Socket<\/em>.\u00a0\u0410 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043a\u0435\u0442\u0430\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439.<\/p>\n<pre><code class=\"java\">\/\/ \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 Socket s = new Socket();  \/\/ \u0432\u044b\u0437\u043e\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b s.read();<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0441\u043e\u043a\u0435\u0442\u044b \u0432\u00a0<code>non-blocking mode<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0\u0418 \u0437\u0430\u0442\u0435\u043c \u0432\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"java\">\/\/ \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 Socket s = new Socket();  \/\/ \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443 \u043f\u043e Java NIO s.setBlockingFalse(true);  \/\/ \u0443\u0440\u0430, \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 s.read();<\/code><\/pre>\n<h3>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b<\/h3>\n<p>\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0432\u044b\u0437\u043e\u0432\u0430\u00a0<code>getURL()<\/code> Java \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 (\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u043e\u043a\u0435\u0442\u0430, \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e \u0438 \u0442. \u0434.) \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u2014 \u043e\u043d\u0430 \u043f\u0440\u043e\u0441\u0438\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432.\u00a0\u0418 \u0432\u043e\u0442 \u0432 \u0447\u0435\u043c \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c: \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java, JVM \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 (TBD: \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u041e\u0421).<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 JVM \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<em>\u0434\u0440\u0443\u0433\u043e\u0439<\/em>\u00a0\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/man7.org\/linux\/man-pages\/man7\/epoll.7.html\" rel=\"noopener noreferrer nofollow\">epoll<\/a>\u00a0\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Unix), \u0438 \u0432\u0430\u043c, \u043a\u0430\u043a Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443, \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0439 \u043a\u043e\u0434 Java NIO.<\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0448\u0438\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 <code>getURL<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0442\u0430\u0440\u044b\u0445 \u0434\u043e\u0431\u0440\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u00a0<em>\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445<\/em>\u00a0\u0441\u043e\u043a\u0435\u0442\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0438\u043b\u043b\u0438\u043e\u043d <em>\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445<\/em>\u00a0\u0441\u043e\u043a\u0435\u0442\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 (\u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0439) \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435, \u0432\u044b \u0431\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u0442\u0435\u0441\u044c \u0441\u00a0<a href=\"https:\/\/serverfault.com\/questions\/533611\/how-do-high-traffic-sites-service-more-than-65535-tcp-connections\" rel=\"noopener noreferrer nofollow\">\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u043e\u0432<\/a>\u00a0\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042d\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 (\u0440\u0430\u0437\u0432\u0435 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u0430\u043a? \ud83d\ude42 ).<\/p>\n<h3>\u0412\u044b\u0437\u043e\u0432\u044b \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>\u041f\u043e\u043a\u0430 \u043c\u044b \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f.\u00a0\u041a\u0430\u043a \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438?<\/p>\n<pre><code class=\"java\">\/\/ \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e!  for (int i = 0; i &lt; 1000000; i++) {     \/\/ Java 19 virtual threads to the rescue?     Thread.startVirtualThread(() -> readFile(someFile))                                         .start(); }<\/code><\/pre>\n<p>\u0421 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u0440\u0435\u0436\u0438\u043c <code>non-blocking<\/code> (\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439). \u00a0\u041d\u043e \u0432\u043e\u0442 \u043f\u0440\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043d\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e IO (\u043d\u0443 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Io_uring\" rel=\"noopener noreferrer nofollow\">io_uring<\/a>\u00a0\u0432 \u043d\u043e\u0432\u044b\u0445 \u044f\u0434\u0440\u0430\u0445).<\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0432\u0430\u0448 \u0432\u044b\u0437\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d (\u2026\u200b \u0431\u0430\u0440\u0430\u0431\u0430\u043d\u043d\u0430\u044f \u0434\u0440\u043e\u0431\u044c\u2026) \u0441\u0442\u0430\u0440\u043e\u043c\u0443 \u0434\u043e\u0431\u0440\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0437\u0438\u044e \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c.<\/p>\n<h3>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438?<\/h3>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0431\u0449\u0435\u0435 \u0438\u043c\u044f\u2026\u00a0<code>Threads<\/code>\u200b, \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\/\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043c\u043d\u0435 \u0447\u0435\u043c-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u044f\u0431\u043b\u043e\u043a\u0430 \u0441 \u0430\u043f\u0435\u043b\u044c\u0441\u0438\u043d\u043e\u043c.<\/p>\n<p>\u042d\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u043a\u0430\u043a \u043e \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u00a0<code>carrier thread<\/code>. \u0418 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u044f\u0436\u0435\u043b\u043e\u0439 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0432\u044b\u0437\u043e\u0432\u044b REST, \u0432\u044b\u0437\u043e\u0432\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0437\u043e\u0432\u044b \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439, \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0438 \u0442. \u0434.) \u044d\u0442\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0441\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430, \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0426\u041f (\u0438\u043b\u0438 \u0443\u0445\u0443\u0434\u0448\u0430\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e). \u00a0\u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0434\u0435\u0436\u0434, \u0434\u0443\u043c\u0430\u044f \u043e \u0434\u043e\u0431\u044b\u0447\u0435 \u0431\u0438\u0442\u043a\u043e\u0439\u043d\u043e\u0432 \u0432 \u0441\u043e\u0442\u043d\u044f\u0445 \u0442\u044b\u0441\u044f\u0447 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<h3>\u0428\u0443\u043c\u0438\u0445\u0430 \u0438 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u044f<\/h3>\n<p>\u041f\u043e\u0447\u0442\u0438\u00a0<a href=\"https:\/\/www.linkedin.com\/pulse\/jdk-19-new-features-java-qdev-technolab\/?trk=public_post\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u0436\u0434\u044b\u0439\u00a0<\/a><a href=\"https:\/\/learningactors.com\/jdk-19-the-new-features-in-java-19\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u0442 \u0432\u00a0<\/a><a href=\"https:\/\/www.azul.com\/blog\/jdk-19-and-what-java-users-should-know-about-it\/\" rel=\"noopener noreferrer nofollow\">\u0431\u043b\u043e\u0433\u0435<\/a>\u00a0\u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 Google, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 JDK 19, \u0434\u043e\u0441\u043b\u043e\u0432\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0441\u0442, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438:<\/p>\n<blockquote>\n<p><code>A preview of virtual threads, which are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput, concurrent applications. Goals include enabling server applications written in the simple thread-per-request style to scale with near-optimal hardware utilization (...) enable troubleshooting, debugging, and profiling of virtual threads with existing JDK tools.<\/code><\/p>\n<\/blockquote>\n<p>\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442:<\/p>\n<blockquote>\n<p>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u044e\u0442 \u0443\u0441\u0438\u043b\u0438\u044f \u043f\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044e \u0437\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0426\u0435\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u0442\u0438\u043b\u0435  \u00ab\u043f\u043e\u0442\u043e\u043a \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u00bb, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f  \u0441 \u043f\u043e\u0447\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f (&#8230;), \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043e\u043a, \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 JDK.<\/p>\n<\/blockquote>\n<p>\u0425\u043e\u0442\u044f \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u044f \u0442\u0430\u043a\u0436\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u0444\u0440\u0430\u0437\u044b, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435, \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u043a \u0438\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u0434\u043e\u043b\u0435\u00a0\u0430\u0436\u0438\u043e\u0442\u0430\u0436\u0430.\u00a0\u0412\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0442\u0438\u043f\u0430\u00a0<a href=\"https:\/\/www.eclipse.org\/jetty\/\" rel=\"noopener noreferrer nofollow\">Jetty<\/a>, \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u044b NIO, \u0433\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c\u0438\u00a0<a href=\"https:\/\/stackoverflow.com\/a\/25195392\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/a><\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u0435\u043b\u0430\u044e\u0442 \u0433\u043b\u0443\u043f\u044b\u0435 \u0432\u0435\u0449\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0432\u044b\u0437\u043e\u0432\u044b REST \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\/\u043f\u043e\u0442\u043e\u043a\u0430\u043c.<\/p>\n<p>\u0418 \u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0442\u0438\u043f\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0432\u043e\u0434\u043e\u043c\/\u0432\u044b\u0432\u043e\u0434\u043e\u043c Project Loom \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0441\u0442\u0430\u0442\u044c.\u00a0Loom \u0434\u0430\u0435\u0442 \u0432\u0430\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u0438\u043b\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u0436\u0435 \u00ab\u043f\u0440\u043e\u0441\u0442\u043e\u00bb   \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 (HTTP\/\u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445\/\u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439), \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u0442\u044c \u043a \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u043e\u00a0<a href=\"https:\/\/github.com\/ReactiveX\/RxJava\" rel=\"noopener noreferrer nofollow\">RxJava<\/a>\u00a0\/\u00a0<a href=\"https:\/\/projectreactor.io\/\" rel=\"noopener noreferrer nofollow\">Project Reactor<\/a>) \u0438 \u0432\u0441\u0435\u0445 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0439 (\u043f\u043e\u0438\u0441\u043a \u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u0438 \u0442.\u0434.).<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445, \u043d\u0435 \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435.\u00a0\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u043e\u0431\u0435\u0434\u043e\u0432 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442.<\/p>\n<h3>\u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 Thread.sleep?<\/h3>\n<p>\u041c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c.\u00a0\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0<code>Thread.sleep()<\/code> \u0432 \u0441\u0442\u0430\u0440\u043e\u043c \u0434\u043e\u0431\u0440\u043e\u043c Java-\u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u041e\u0421, \u0432\u044b, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043a \u0432 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438.\u00a0\u0427\u0442\u043e\u00a0<s>\u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c,<\/s>\u00a0\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u043c \u0434\u043b\u044f 100_000 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435\u00a0<code>VirtualThread.sleep()<\/code>, \u0432\u044b \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043a\u0430\u043a \u0441\u043f\u044f\u0449\u0438\u0439 \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0441\u0442\u0430\u0440\u043e\u0439 \u0434\u043e\u0431\u0440\u043e\u0439 Java (\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u041e\u0421)\u00a0<code>ScheduledThreadPoolExecutor<\/code>.\u00a0\u042d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u00a0\u0440\u0430\u0441\u043f\u0430\u0440\u043a\u0443\u0435\u0442 \/ \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u0432\u0430\u0448 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f.\u00a0\u0423\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0430\u0441: \u043e\u043f\u044f\u0442\u044c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u044f\u0431\u043b\u043e\u043a \u0438 \u0430\u043f\u0435\u043b\u044c\u0441\u0438\u043d\u043e\u0432?<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0439?\u00a0\u041e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<p>\u0422\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0435\u0439 <a href=\"https:\/\/www.marcobehler.com\/guides\/load-testing\" rel=\"noopener noreferrer nofollow\">Load Testing: An Unorthodox Guide<\/a>  (\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u043d\u0435\u043e\u0440\u0442\u043e\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e), \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0449\u0430\u0445, \u043a\u0440\u043e\u043c\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h3>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e\u00a0<a href=\"https:\/\/twitter.com\/tagir_valeev?\" rel=\"noopener noreferrer nofollow\">\u0422\u0430\u0433\u0438\u0440\u0443 \u0412\u0430\u043b\u0435\u0435\u0432\u0443<\/a>, \u0412\u0441\u0435\u0432\u043e\u043b\u043e\u0434\u0443 \u0422\u043e\u043b\u0441\u0442\u043e\u043f\u044f\u0442\u043e\u0432\u0443 \u0438\u00a0<a href=\"https:\/\/twitter.com\/ae____\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0434\u0440\u0435\u0430\u0441\u0443 \u042d\u0439\u0437\u0435\u043b\u0435<\/a>\u00a0\u0437\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438\/\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\/\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/698440\/\"> https:\/\/habr.com\/ru\/post\/698440\/<\/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>\u042d\u0442\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 Project Loom \u0432 Java \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 (\u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u00abfibers\u00bb) \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u00ab\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c\u00bb.<\/p>\n<h3>\u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Project Loom<\/h3>\n<p>\u041f\u044b\u0442\u0430\u044f\u0441\u044c \u043e\u0441\u0432\u043e\u0438\u0442\u044c\u00a0<a href=\"https:\/\/jdk.java.net\/19\" rel=\"noopener noreferrer nofollow\">Project Loom \u0434\u043b\u044f Java 19<\/a>, \u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=EVZnk1ZyYeQ\" rel=\"noopener noreferrer nofollow\">\u0432\u044b\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u041d\u0438\u043a\u043e\u043b\u0430\u044f \u041f\u0430\u0440\u043b\u043e\u0433\u0430<\/a>\u00a0\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u00a0<a href=\"https:\/\/developer.okta.com\/blog\/2022\/08\/26\/state-of-java-project-loom\" rel=\"noopener noreferrer nofollow\">\u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0442\u043e\u0432 \u0432\u00a0<\/a><a href=\"https:\/\/medium.com\/javarevisited\/how-i-spun-up-5-million-virtual-threads-without-stalling-the-jvm-1188d806e6bd\" rel=\"noopener noreferrer nofollow\">\u0431\u043b\u043e\u0433\u0435<\/a>.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u043d\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0438, \u043a\u0430\u043a\u00a0<code>virtual threads<\/code> (\u0438\u043b\u0438\u00a0<code>fibers<\/code>) \u043c\u043e\u0433\u0443\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0441\u043e\u0442\u0435\u043d \u0442\u044b\u0441\u044f\u0447 \u0438\u043b\u0438 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 Java-\u043f\u043e\u0442\u043e\u043a\u0438, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u041e\u0421, \u043c\u043e\u0433\u043b\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e \u043f\u0430\u0440\u044b \u0442\u044b\u0441\u044f\u0447 (TBD: \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0443 \u043e \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u041e\u0421 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445). <\/p>\n<pre><code class=\"java\">try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {     IntStream.range(0, 100_000).forEach(i -> executor.submit(() -> {  \/\/ (1)         Thread.sleep(Duration.ofSeconds(1));         System.out.println(i);         return i;     })); }<\/code><\/pre>\n<ol>\n<li>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 \u0431\u043b\u043e\u0433\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043f\u0430\u0442\u044c 100 000 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0441\u043f\u044f\u0449\u0438\u0445 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 &#8212; \u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e.\u00a0\u041d\u043e \u043c\u043e\u0433\u0443 \u043b\u0438 \u044f \u0442\u0435\u043f\u0435\u0440\u044c \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c 100 000 HTTP-\u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432?<\/p>\n<pre><code class=\"java\">\/\/ \u043a\u0430\u043a\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430?  for (int i = 0; i &lt; 1000000; i++) {     \/\/ good, old Java Threads     new Thread( getURL(\"https:\/\/www.marcobehler.com\"))         .start(); }   for (int i = 0; i &lt; 1000000; i++) {     \/\/ \u0412\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java 19 \u0441\u043f\u0435\u0448\u0430\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c?     Thread.startVirtualThread(() -> getURL(\"https:\/\/www.marcobehler.com\"))         .start(); }<\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439 \u0432\u044b\u044f\u0441\u043d\u0438\u043c.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Java \u0432\u044b\u0437\u043e\u0432\u044b \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442\u0441\u044f?<\/h3>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430\u00a0<code>getURL<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 URL-\u0430\u0434\u0440\u0435\u0441 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<pre><code class=\"java\">static String getURL(String url) {     try (InputStream in = new URL(url).openStream()) {         byte[] bytes = in.readAllBytes(); \/\/ ALERT, ALERT!         return new String(bytes);     } catch (IOException e) {         throw new RuntimeException(e);     } }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0435 JavaDoc \u043f\u0440\u043e <code>inputStream.readAllBytes()<\/code> \u0438\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u0432\u0435\u0437\u043b\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u0443\u0440\u0441 Java 101, \u0432\u0430\u043c \u0432\u0434\u0430\u043b\u0431\u043b\u0438\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u044b \u0432\u0441\u0435 \u0431\u0430\u0439\u0442\u044b, \u0442.\u0435. \u0432\u0430\u0448 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u043c\u043e\u0433\u0443 \u044f\u043a\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0440\u0430\u0437 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e, \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043d\u043e \u043d\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432?<\/p>\n<p>\u0427\u0430\u0441\u0442\u0438 \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438 \u2014 \u0442\u0435\u043c\u044b, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0437\u043d\u0430\u043b\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0441\u043b\u0435 CS 101: Sockets &amp; Syscalls.<\/p>\n<h3>\u0421\u043e\u043a\u0435\u0442\u044b<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c HTTP-\u0432\u044b\u0437\u043e\u0432 \u0438\u043b\u0438, \u0441\u043a\u043e\u0440\u0435\u0435, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u0432\u044b (\u0438\u043b\u0438, \u0441\u043a\u043e\u0440\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0430 \u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435) \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0435\u00a0<em>Socket<\/em>.\u00a0\u0410 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u043e\u043a\u0435\u0442\u0430\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439.<\/p>\n<pre><code class=\"java\">\/\/ \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 Socket s = new Socket();  \/\/ \u0432\u044b\u0437\u043e\u0432 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b s.read();<\/code><\/pre>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0441\u043e\u043a\u0435\u0442\u044b \u0432\u00a0<code>non-blocking mode<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.\u00a0\u0418 \u0437\u0430\u0442\u0435\u043c \u0432\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u043e\u0437\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"java\">\/\/ \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 Socket s = new Socket();  \/\/ \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443 \u043f\u043e Java NIO s.setBlockingFalse(true);  \/\/ \u0443\u0440\u0430, \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 s.read();<\/code><\/pre>\n<h3>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b<\/h3>\n<p>\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u0432\u044b\u0437\u043e\u0432\u0430\u00a0<code>getURL()<\/code> Java \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 (\u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435 \u0441\u043e\u043a\u0435\u0442\u0430, \u0447\u0442\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e \u0438 \u0442. \u0434.) \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u2014 \u043e\u043d\u0430 \u043f\u0440\u043e\u0441\u0438\u0442 \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432.\u00a0\u0418 \u0432\u043e\u0442 \u0432 \u0447\u0435\u043c \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c: \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java, JVM \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 (TBD: \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u041e\u0421).<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 JVM \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u00a0<em>\u0434\u0440\u0443\u0433\u043e\u0439<\/em>\u00a0\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u043c (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f\u00a0<a href=\"https:\/\/man7.org\/linux\/man-pages\/man7\/epoll.7.html\" rel=\"noopener noreferrer nofollow\">epoll<\/a>\u00a0\u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Unix), \u0438 \u0432\u0430\u043c, \u043a\u0430\u043a Java \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443, \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0439 \u043a\u043e\u0434 Java NIO.<\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0438 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u043d\u0430\u0448\u0438\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438 <code>getURL<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0442\u0430\u0440\u044b\u0445 \u0434\u043e\u0431\u0440\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u00a0<em>\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445<\/em>\u00a0\u0441\u043e\u043a\u0435\u0442\u043e\u0432, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043c\u0438\u043b\u043b\u0438\u043e\u043d <em>\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445<\/em>\u00a0\u0441\u043e\u043a\u0435\u0442\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438 \u044d\u0442\u043e\u0442 (\u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0439) \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435, \u0432\u044b \u0431\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0435 \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u0442\u0435\u0441\u044c \u0441\u00a0<a href=\"https:\/\/serverfault.com\/questions\/533611\/how-do-high-traffic-sites-service-more-than-65535-tcp-connections\" rel=\"noopener noreferrer nofollow\">\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0441\u043e\u043a\u0435\u0442\u043e\u0432<\/a>\u00a0\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u042d\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435 (\u0440\u0430\u0437\u0432\u0435 \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u0430\u043a? \ud83d\ude42 ).<\/p>\n<h3>\u0412\u044b\u0437\u043e\u0432\u044b \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>\u041f\u043e\u043a\u0430 \u043c\u044b \u0432 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f.\u00a0\u041a\u0430\u043a \u0431\u0443\u0434\u0443\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438?<\/p>\n<pre><code class=\"java\">\/\/ \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u043c \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e!  for (int i = 0; i &lt; 1000000; i++) {     \/\/ Java 19 virtual threads to the rescue?     Thread.startVirtualThread(() -> readFile(someFile))                                         .start(); }<\/code><\/pre>\n<p>\u0421 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438 \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043d\u0430 \u0440\u0435\u0436\u0438\u043c <code>non-blocking<\/code> (\u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439). \u00a0\u041d\u043e \u0432\u043e\u0442 \u043f\u0440\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043d\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e IO (\u043d\u0443 \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Io_uring\" rel=\"noopener noreferrer nofollow\">io_uring<\/a>\u00a0\u0432 \u043d\u043e\u0432\u044b\u0445 \u044f\u0434\u0440\u0430\u0445).<\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0432\u0430\u0448 \u0432\u044b\u0437\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0443 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d (\u2026\u200b \u0431\u0430\u0440\u0430\u0431\u0430\u043d\u043d\u0430\u044f \u0434\u0440\u043e\u0431\u044c\u2026) \u0441\u0442\u0430\u0440\u043e\u043c\u0443 \u0434\u043e\u0431\u0440\u043e\u043c\u0443 \u043f\u043e\u0442\u043e\u043a\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0430\u043c \u0438\u043b\u043b\u044e\u0437\u0438\u044e \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u0430\u0439\u043b\u0430\u043c.<\/p>\n<h3>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438?<\/h3>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 Java \u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0431\u0449\u0435\u0435 \u0438\u043c\u044f\u2026\u00a0<code>Threads<\/code>\u200b, \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\/\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043c\u043d\u0435 \u0447\u0435\u043c-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u044f\u0431\u043b\u043e\u043a\u0430 \u0441 \u0430\u043f\u0435\u043b\u044c\u0441\u0438\u043d\u043e\u043c.<\/p>\n<p>\u042d\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u043e \u043c\u0435\u043d\u044f \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445 \u043a\u0430\u043a \u043e \u0437\u0430\u0434\u0430\u0447\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u043c\u00a0<code>carrier thread<\/code>. \u0418 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0443\u0436\u043d\u044b \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u044f\u0436\u0435\u043b\u043e\u0439 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 (\u0432\u044b\u0437\u043e\u0432\u044b REST, \u0432\u044b\u0437\u043e\u0432\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u044b\u0437\u043e\u0432\u044b \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439, \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0438 \u0442. \u0434.) \u044d\u0442\u043e \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u043e\u0447\u043d\u043e \u0434\u0430\u0441\u0442 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430, \u0438 \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0426\u041f (\u0438\u043b\u0438 \u0443\u0445\u0443\u0434\u0448\u0430\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e). \u00a0\u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0434\u0435\u0436\u0434, \u0434\u0443\u043c\u0430\u044f \u043e \u0434\u043e\u0431\u044b\u0447\u0435 \u0431\u0438\u0442\u043a\u043e\u0439\u043d\u043e\u0432 \u0432 \u0441\u043e\u0442\u043d\u044f\u0445 \u0442\u044b\u0441\u044f\u0447 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<h3>\u0428\u0443\u043c\u0438\u0445\u0430 \u0438 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u044f<\/h3>\n<p>\u041f\u043e\u0447\u0442\u0438\u00a0<a href=\"https:\/\/www.linkedin.com\/pulse\/jdk-19-new-features-java-qdev-technolab\/?trk=public_post\" rel=\"noopener noreferrer nofollow\">\u043a\u0430\u0436\u0434\u044b\u0439\u00a0<\/a><a href=\"https:\/\/learningactors.com\/jdk-19-the-new-features-in-java-19\/\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u0442 \u0432\u00a0<\/a><a href=\"https:\/\/www.azul.com\/blog\/jdk-19-and-what-java-users-should-know-about-it\/\" rel=\"noopener noreferrer nofollow\">\u0431\u043b\u043e\u0433\u0435<\/a>\u00a0\u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0432 Google, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0439 \u0441 JDK 19, \u0434\u043e\u0441\u043b\u043e\u0432\u043d\u043e \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0441\u0442, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438:<\/p>\n<blockquote>\n<p><code>A preview of virtual threads, which are lightweight threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput, concurrent applications. Goals include enabling server applications written in the simple thread-per-request style to scale with near-optimal hardware utilization (...) enable troubleshooting, debugging, and profiling of virtual threads with existing JDK tools.<\/code><\/p>\n<\/blockquote>\n<p>\u0427\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442:<\/p>\n<blockquote>\n<p>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043b\u0438\u0437 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u043b\u0435\u0433\u0447\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043d\u0438\u0436\u0430\u044e\u0442 \u0443\u0441\u0438\u043b\u0438\u044f \u043f\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044e \u0437\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0426\u0435\u043b\u0438 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0432 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u044b\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u0441\u0442\u0438\u043b\u0435  \u00ab\u043f\u043e\u0442\u043e\u043a \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u00bb, \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f  \u0441 \u043f\u043e\u0447\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f (&#8230;), \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u043f\u043e\u043b\u0430\u0434\u043e\u043a, \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0438 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 JDK.<\/p>\n<\/blockquote>\n<p>\u0425\u043e\u0442\u044f \u044f \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0442\u043e\u043a\u0438 \u2014 \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u044f \u0442\u0430\u043a\u0436\u0435 \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u0444\u0440\u0430\u0437\u044b, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435, \u043f\u0440\u0438\u0432\u0435\u0434\u0443\u0442 \u043a \u0438\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u0434\u043e\u043b\u0435\u00a0\u0430\u0436\u0438\u043e\u0442\u0430\u0436\u0430.\u00a0\u0412\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u044b \u0442\u0438\u043f\u0430\u00a0<a href=\"https:\/\/www.eclipse.org\/jetty\/\" rel=\"noopener noreferrer nofollow\">Jetty<\/a>, \u0443\u0436\u0435 \u0434\u0430\u0432\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u043e\u0440\u044b NIO, \u0433\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c\u0438\u00a0<a href=\"https:\/\/stackoverflow.com\/a\/25195392\" rel=\"noopener noreferrer nofollow\">\u0441\u043e\u0442\u043d\u0438 \u0442\u044b\u0441\u044f\u0447 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/a><\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u0435\u043b\u0430\u044e\u0442 \u0433\u043b\u0443\u043f\u044b\u0435 \u0432\u0435\u0449\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442 \u0432\u044b\u0437\u043e\u0432\u044b REST \u0438\u043b\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044f\u043c\/\u043f\u043e\u0442\u043e\u043a\u0430\u043c.<\/p>\n<p>\u0418 \u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0442\u0438\u043f\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0432\u043e\u0434\u043e\u043c\/\u0432\u044b\u0432\u043e\u0434\u043e\u043c Project Loom \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0431\u043b\u0438\u0441\u0442\u0430\u0442\u044c.\u00a0Loom \u0434\u0430\u0435\u0442 \u0432\u0430\u043c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0443 \u0438\u043b\u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u0436\u0435 \u00ab\u043f\u0440\u043e\u0441\u0442\u043e\u00bb   \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u044e\u0449\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 (HTTP\/\u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445\/\u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439), \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u0442\u044c \u043a \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u0435 \u043e\u00a0<a href=\"https:\/\/github.com\/ReactiveX\/RxJava\" rel=\"noopener noreferrer nofollow\">RxJava<\/a>\u00a0\/\u00a0<a href=\"https:\/\/projectreactor.io\/\" rel=\"noopener noreferrer nofollow\">Project Reactor<\/a>) \u0438 \u0432\u0441\u0435\u0445 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u0445 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0439 (\u043f\u043e\u0438\u0441\u043a \u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0442\u043b\u0430\u0434\u043a\u0430 \u0438 \u0442.\u0434.).<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043e\u0431 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0434\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445, \u043d\u0435 \u0437\u043d\u0430\u044f, \u0447\u0442\u043e \u0432\u044b \u0434\u0435\u043b\u0430\u0435\u0442\u0435.\u00a0\u0411\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0445 \u043e\u0431\u0435\u0434\u043e\u0432 \u043d\u0435 \u0431\u044b\u0432\u0430\u0435\u0442.<\/p>\n<h3>\u041a\u0430\u043a \u043d\u0430\u0441\u0447\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 Thread.sleep?<\/h3>\n<p>\u041c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c.\u00a0\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442?<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u00a0<code>Thread.sleep()<\/code> \u0432 \u0441\u0442\u0430\u0440\u043e\u043c \u0434\u043e\u0431\u0440\u043e\u043c Java-\u043f\u043e\u0442\u043e\u043a\u0435, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u043c \u041e\u0421, \u0432\u044b, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u043f\u043e\u0442\u043e\u043a \u0432 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438.\u00a0\u0427\u0442\u043e\u00a0<s>\u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u043c,<\/s>\u00a0\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u044b\u043c \u0434\u043b\u044f 100_000 \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435\u00a0<code>VirtualThread.sleep()<\/code>, \u0432\u044b \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043a\u0430\u043a \u0441\u043f\u044f\u0449\u0438\u0439 \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u0442\u0435 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u0441\u0442\u0430\u0440\u043e\u0439 \u0434\u043e\u0431\u0440\u043e\u0439 Java (\u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u041e\u0421)\u00a0<code>ScheduledThreadPoolExecutor<\/code>.\u00a0\u042d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430\u00a0\u0440\u0430\u0441\u043f\u0430\u0440\u043a\u0443\u0435\u0442 \/ \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u0432\u0430\u0448 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043f\u043e \u0438\u0441\u0442\u0435\u0447\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f.\u00a0\u0423\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0430\u0441: \u043e\u043f\u044f\u0442\u044c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u044f\u0431\u043b\u043e\u043a \u0438 \u0430\u043f\u0435\u043b\u044c\u0441\u0438\u043d\u043e\u0432?<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u043e\u0433\u0440\u0443\u0436\u0435\u043d\u0438\u0439?\u00a0\u041e\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<p>\u0422\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0435\u0439 <a href=\"https:\/\/www.marcobehler.com\/guides\/load-testing\" rel=\"noopener noreferrer nofollow\">Load Testing: An Unorthodox Guide<\/a>  (\u041d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u043d\u0435\u043e\u0440\u0442\u043e\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e), \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f \u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0449\u0430\u0445, \u043a\u0440\u043e\u043c\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h3>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e\u00a0<a href=\"https:\/\/twitter.com\/tagir_valeev?\" rel=\"noopener noreferrer nofollow\">\u0422\u0430\u0433\u0438\u0440\u0443 \u0412\u0430\u043b\u0435\u0435\u0432\u0443<\/a>, \u0412\u0441\u0435\u0432\u043e\u043b\u043e\u0434\u0443 \u0422\u043e\u043b\u0441\u0442\u043e\u043f\u044f\u0442\u043e\u0432\u0443 \u0438\u00a0<a href=\"https:\/\/twitter.com\/ae____\" rel=\"noopener noreferrer nofollow\">\u0410\u043d\u0434\u0440\u0435\u0430\u0441\u0443 \u042d\u0439\u0437\u0435\u043b\u0435<\/a>\u00a0\u0437\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438\/\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\/\u043e\u0431\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u044f.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/698440\/\"> https:\/\/habr.com\/ru\/post\/698440\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-341216","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341216","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=341216"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/341216\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=341216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=341216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}