{"id":355391,"date":"2024-05-20T23:07:44","date_gmt":"2024-05-20T23:07:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=355391"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=355391","title":{"rendered":"<span>OOM: direct memory \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0441\u0435\u0442\u044c\u044e TCP\/IP \u0447\u0435\u0440\u0435\u0437 NIO \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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fae\/51f\/3c2\/fae51f3c25bc204b9b841e8a05f828a4.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fae\/51f\/3c2\/fae51f3c25bc204b9b841e8a05f828a4.png\"\/><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u0435\u043d\u0438\u0441 \u0410\u0433\u0430\u043f\u0438\u0442\u043e\u0432, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b Platform  Core\u00a0\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Bercut. \u0420\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0431\u0435\u0437 \u043c\u0430\u043b\u043e\u0433\u043e 20 \u043b\u0435\u0442, \u0438\u0437 \u043d\u0438\u0445 18 \u043f\u0438\u0448\u0443 \u043d\u0430 Java.<\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u043e\u043f\u044b\u0442\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u0442\u044d\u043a\u0430 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 NIO \u0432 Java.<\/p>\n<p>\u042d\u0442\u0430  \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0431\u043e\u0440\u044c\u0431\u044b \u0441 &#171;OutOfMemory: direct  memory&#187; \u0432 \u0448\u0438\u043d\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u0413\u0440\u0443\u043f\u043f\u0430 Platform Core, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0436\u0443, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c <a href=\"https:\/\/bercut.com\/products\/hybrid-integration-platform\/\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b<\/a>, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435.<\/p>\n<p>\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f:<\/p>\n<ul>\n<li>\n<p>\u0428\u0438\u043d\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 ESB.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f  API Gateway, SLES (\u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432), SA Container  (\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u043d\u0430 Java), Notification Broker.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b: Scheduler, Service Profile Management \u0438 \u043f\u0440\u043e\u0447\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u043e Spring.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0432\u0438\u0433\u043b\u0438 \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u0438\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Bercut<\/h2>\n<p>\u041d\u0430\u0448\u0430 \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u0443\u044e  \u0448\u0438\u043d\u0443 (RTSIB). \u042d\u0442\u043e ESB (<em>enterprise service bus)<\/em> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b SOA (<em>service-oriented architecture<\/em>) \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0442\u0435\u043a\u0430\u043c\u0438 HTTP \u0438 \u043f\u0440\u043e\u043f\u0440\u0438\u0435\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 RTSIB.<\/p>\n<p>\u041f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u044d\u0442\u043e mesh-\u0441\u0435\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435  RTSIB \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 &#8212; \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u043c \u0438 \u043f\u0438\u0448\u0443\u0449\u0438\u043c, \u043f\u0440\u0438  \u044d\u0442\u043e\u043c \u043f\u0438\u0448\u0443\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0438\u0433\u0440\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u0430 \u0441\u043e\u043a\u0435\u0442 \u0437\u0430\u043d\u044f\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u043e\u043a\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u043e\u043a\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u044f\u043c\u043e \u0441 \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p>HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c  \u0432\u0435\u0440\u0441\u0438\u044e 1.x) \u0432 \u0432\u0438\u0434\u0443 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430  \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u043b\u044f \u043d\u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043f\u0443\u043b\u0430 &#8212; \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u043d\u0430 25 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u043a \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043c\u044b \u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0437\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438.<\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e TCP\/IP \u0432 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0432 Java<\/h2>\n<p>\u041a\u0442\u043e \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u0442\u0435\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u043e\u043a\u0435\u0442 \u043d\u0430 Java \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u044e\u0431\u0438\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b JDK, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0437\u043d\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u043a\u0435\u0442\u043e\u043c, \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0435\u0449\u0451 \u0440\u0430\u0437 \u0438\u0445 \u043f\u0440\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c.<\/p>\n<p>\u0418\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432\u00a0Open JDK 13 (\u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f  \u0432\u0435\u0440\u0441\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0443 \u043d\u0430\u0441 Java) \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 ByteBuffer \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f DirectByteBuffer, \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0440\u0430\u0437\u0443  (writeFromNativeBuffer), \u0430 \u0435\u0441\u043b\u0438 \u043e\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0432 Heap, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 DirectByteBuffer, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c  \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e DirectByteBuffer.<\/p>\n<p>\u041a\u043e\u0434 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0441\u043e\u043a\u0435\u0442 \u0438\u0437 Open JDK 13 ( <em>IOUtil.java <\/em>):<\/p>\n<pre><code class=\"java\">static int write(FileDescriptor fd, ByteBuffer src, long position,                  boolean directIO, int alignment, NativeDispatcher nd)     throws IOException {     if (src instanceof DirectBuffer) {         return writeFromNativeBuffer(fd, src, position, directIO, alignment, nd);     }       \/\/ Substitute a native buffer     int pos = src.position();     int lim = src.limit();     assert (pos &lt;= lim);     int rem = (pos &lt;= lim ? lim - pos : 0);     ByteBuffer bb;     if (directIO) {         Util.checkRemainingBufferSizeAligned(rem, alignment);         bb = Util.getTemporaryAlignedDirectBuffer(rem, alignment);     } else {         bb = Util.getTemporaryDirectBuffer(rem);     }     try {         bb.put(src);         bb.flip();         \/\/ Do not update src until we see how many bytes were written         src.position(pos);           int n = writeFromNativeBuffer(fd, bb, position, directIO, alignment, nd);         if (n > 0) {             \/\/ now update src             src.position(pos + n);         }         return n;     } finally {         Util.offerFirstTemporaryDirectBuffer(bb);     } }<\/code><\/pre>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0442\u043e, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 JDK \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u041a\u042d\u0428 DirectByteBuffer \u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u043a \u043f\u043e\u0442\u043e\u043a\u0443 (ThreadLocal):<\/p>\n<pre><code class=\"java\">private static ThreadLocal&lt;BufferCache> bufferCache = new TerminatingThreadLocal&lt;>() {     @Override     protected BufferCache initialValue() {         return new BufferCache();     }     @Override     protected void threadTerminated(BufferCache cache) { \/\/ will never be null         while (!cache.isEmpty()) {             ByteBuffer bb = cache.removeFirst();             free(bb);         }     } };   public static ByteBuffer getTemporaryDirectBuffer(int size) {     \/\/ If a buffer of this size is too large for the cache, there     \/\/ should not be a buffer in the cache that is at least as     \/\/ large. So we'll just create a new one. Also, we don't have     \/\/ to remove the buffer from the cache (as this method does     \/\/ below) given that we won't put the new buffer in the cache.     if (isBufferTooLarge(size)) {         return ByteBuffer.allocateDirect(size);     }       BufferCache cache = bufferCache.get();     ByteBuffer buf = cache.get(size);     if (buf != null) {         return buf;     } else {         \/\/ No suitable buffer in the cache so we need to allocate a new         \/\/ one. To avoid the cache growing then we remove the first         \/\/ buffer from the cache and free it.         if (!cache.isEmpty()) {             buf = cache.removeFirst();             free(buf);         }         return ByteBuffer.allocateDirect(size);     } }<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e DirectByteBuffer, \u043e\u043d \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u041a\u042d\u0428. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432 \u041a\u042d\u0428\u0435 \u043d\u0435\u0442 DirectByteBuffer \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043e\u043d \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u041a\u042d\u0428 ( Util.offerFirstTemporaryDirectBuffer(bb) ).<\/p>\n<h2>\u0421\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 HeapByteBuffer \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e static-\u0444\u0443\u043d\u043a\u0446\u0438\u044e ByteBuffer.wrap(byte[] data) \u0438 \u0431\u0435\u0434 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0435 \u0437\u043d\u0430\u043b\u0438.<\/p>\n<p>\u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f  \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 telecom-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435, \u043d\u043e \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 DWH (<em>Data Warehouse<\/em>), \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448\u0443 \u0448\u0438\u043d\u0443 \u0434\u043e\u0441\u0442\u0438\u0433 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u0432 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0430\u0445 \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 OOM Direct Memory.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e? \u0410 \u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443: \u043a\u0430\u043a \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u0432\u044b\u0448\u0435, \u043c\u044b \u0438\u043c\u0435\u0435\u043c mesh-\u0441\u0435\u0442\u044c \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0438\u043c\u0435\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u0438 \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 off-heap \u043f\u0430\u043c\u044f\u0442\u044c \u0432 ThreadLocal \u041a\u042d\u0428\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0414\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f  off-heap \u043f\u0430\u043c\u044f\u0442\u0438\u00a0 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c OOM. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0431\u044b\u043b\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 JVM &#171;-XX:MaxDirectMemorySize&#187;. \u0420\u0430\u0437\u043c\u0435\u0440  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 direct \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0435\u0449\u0451. \u042d\u0442\u043e  \u0441\u0442\u0430\u043b\u043e \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0437\u0432\u043e\u043d\u043e\u0447\u043a\u043e\u043c, \u0447\u0442\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435.<\/p>\n<h2>\u0410\u043d\u0430\u043b\u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 \u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0448\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u041f\u0438\u0441\u0430\u0442\u044c \u0432 \u0446\u0438\u043a\u043b\u0435 \u0431\u043b\u043e\u043a\u0430\u043c\u0438, \u0441\u0434\u0432\u0438\u0433\u0430\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e position \u0438 limit \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c  ByteBuffer. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043c\u043e\u0447\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 IOUtils \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 DirectByteBuffer \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c size = limit &#8212; position.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 ByteBuffer.allocateDirect().<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043d\u0430\u0440\u0435\u0437\u043a\u0443 \u0438\u0437 ByteBuffer \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0433\u0434\u0435 ByteBuffer \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432\u0441\u0451 \u0433\u043b\u0443\u0431\u0436\u0435 \u0432  \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 ByteBuffer \u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430.<\/p>\n<p>\u0417\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 4 \u0432\u0438\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u043a\u0435\u0442\u043e\u043c:<\/p>\n<ul>\n<li>\n<p>\u0410\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 HeapByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0410\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 DirectByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 HeapByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 DirectByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412  \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0440\u0448\u0430\u043b\u043b\u0438\u043d\u0433 (\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438), \u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044e \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ByteBuffer.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u043a\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0441 \u043d\u0438\u043c\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/agapitov-prog\/nio-test\" rel=\"noopener noreferrer nofollow\">Github<\/a>.<\/p>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9ef\/e30\/5d1\/9efe305d14bdee5b6916ebe9c3469e65.png\" width=\"2000\" height=\"1200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9ef\/e30\/5d1\/9efe305d14bdee5b6916ebe9c3469e65.png\"\/><\/figure>\n<p>\u0418\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043e 1Mb \u0441\u0430\u043c\u044b\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044f DirectByteBuffer. \u0410\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044f HeapByteBuffer \u0447\u0435\u0440\u0435\u0437 wrap \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 HeapByteBuffer \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0432\u043d\u044b \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043b\u0438\u0434\u0435\u0440\u0441\u0442\u0432\u043e\u043c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e. \u0418\u0437 \u043e\u0431\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0432\u044b\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 DirectByteBuffer, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u043d \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0430 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 3 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043d\u0430\u0440\u0435\u0437\u043a\u0443 \u0438\u0437 DirectByteBuffer \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0438\u0439 \u043f\u0443\u043b. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 (\u0440\u0430\u0437\u043c\u0435\u0440 DirectByteBuffer) \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 32Kb \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043f\u0438\u043a \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438. \u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438 \u0441\u0442\u044d\u043a HTTPs, \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442  \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043f\u0443\u043b \u0441 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0442 32Kb \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 DirectByteBuffer, \u043e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043d\u0430 PacketBufferSize \u0438 ApplicationBufferSize \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 SSLEngine.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u043e\u0439 CompositeBuffer, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0438 Input\/Output streams, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 CompositeBuffer. \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f  \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043b\u043e\u044f marshalling\/unmarshalling.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0443\u0436\u0435 \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 DirectByteBuffer \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u044d\u043a \u043d\u0430 CAS \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0435:<\/p>\n<pre><code class=\"java\">public class CasStack&lt;L extends LinkedObject&lt;L>> {       public interface LinkedObject&lt;L extends LinkedObject> {               public L getNext();                   public void setNext(L next);               }       private final AtomicReference&lt;L> head = new AtomicReference&lt;>();       public void add(L lo) {         for (;;) {             lo.setNext(head.get());             if (head.compareAndSet(lo.getNext(), lo)) {                 return;             }         }     }       public L poll() {         L lo;         for (;;) {             lo = head.get();             if (lo == null) {                 return null;             }             if (head.compareAndSet(lo, lo.getNext())) {                 lo.setNext(null);                 return lo;             }         }       }   }<\/code><\/pre>\n<p>\u0410 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0447\u0430\u0441\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 CompositeBuffer \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0447\u0442\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u0441\u043e\u043a\u0435\u0442 (\u043a\u043e\u0434 \u0431\u044b\u043b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0441\u0442\u0430\u0442\u044c\u0438):<\/p>\n<pre><code class=\"java\">DirectByteBuffer[] buffers; int pos;   @Override public int getBufIndex(int position) {     return position \/ pool.getPartCapacity(); }   @Override public int read(ReadableByteChannel channel) throws IOException {     ensureCapacity();     int cur = getBufIndex(pos), readed = 0, read;     for (;;) {         try {             if (hasRemaining()) {                 if (buffers[cur].hasRemaining()) {                     read = channel.read(containers[cur]);                     if (read &lt; 0) {                         return readed > 0 ? readed : read;                     }                     pos += read;                     readed += read;                     if (containers[cur].hasRemaining()) {                         return readed;                     }                 }                 cur++;                 if (cur == containers.length) {                     expandCapacity();                 }             } else {                 return readed;             }         } catch (IOException) {             if (readed > 0) {                 return readed;             }             throw ex;         }     } }   @Override public int write(WritableByteChannel channel) throws IOException {     int cur = getBufIndex(pos), writed = 0, write;     for (;;) {         try {             if (hasRemaining()) {                 if (buffers[cur].hasRemaining()) {                     write = channel.write(buffers[cur]);                     if (write &lt; 0) {                         return writed > 0 ? writed : write;                     }                     pos += write;                     writed += write;                     if (buffers[cur].hasRemaining()) {                         return writed;                     }                 }                 cur++;                 if (cur == containers.length) {                     if (writed == 0 &amp;&amp; hasRemaining()) {                         release();                         throw new CompositeBufferLifecycleError();                     }                     return writed;                 }             } else {                 return writed;             }         } catch (IOException ex) {             if (writed > 0) {                 return writed;             }             throw ex;         }     } }<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441, \u0430 \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a DirectContainer \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b addRef\/releaseRef, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u0432\u0441\u0435\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439  DirectByteBuffer \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u0430\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0448\u0438\u043d\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0430\u0441\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u0434\u0432\u043e\u0435.<\/p>\n<p>\u0414\u043e  \u0434\u0430\u043d\u043d\u043e\u0439 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0437\u043c\u0435\u0440 off-heap \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0433 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c 1-3Gb \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b\u0441\u044f \u0438\u0437 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u0436\u0434\u043e\u0435  \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 off-heap \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0443\u043b\u0430\u043c\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043a\u0440\u043e\u043c\u043d\u043e\u0435 &#8212; \u043d\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043e\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 10-20 Mb.<\/p>\n<p>\u041d\u0430  \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435 \u0441 \u043f\u0430\u0440\u043e\u0439 \u0441\u043e\u0442\u0435\u043d \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0442 \u0434\u043e 15 \u0442\u044b\u0441\u044f\u0447 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 &#8212; \u0440\u0430\u0437\u043c\u0435\u0440 off-heap \u043f\u0443\u043b\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u0435\u043d\u0435\u0435 100Mb.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e \u0435\u0449\u0451 \u0438 \u0442\u043e, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c off-heap \u043f\u0430\u043c\u044f\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u0430 \u0438 \u0440\u0430\u0441\u0442\u0451\u0442 \u043d\u0435 \u043e\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (\u043f\u043e\u0442\u043e\u043a\u043e\u0432), \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438 \u0441 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439\u00a0\u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u0448\u0438\u043d\u0443 \u0432 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0434\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440 off-heap \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0432\u0448\u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u0443\u0437\u0435\u043b.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c OOM direct  memory \u0442\u0430\u043a\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c off-heap \u043f\u0430\u043c\u044f\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0433\u043d\u043e\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/762254\/\"> https:\/\/habr.com\/ru\/articles\/762254\/<\/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<figure class=\"full-width\"><\/figure>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0414\u0435\u043d\u0438\u0441 \u0410\u0433\u0430\u043f\u0438\u0442\u043e\u0432, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0433\u0440\u0443\u043f\u043f\u044b Platform  Core\u00a0\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Bercut. \u0420\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0431\u0435\u0437 \u043c\u0430\u043b\u043e\u0433\u043e 20 \u043b\u0435\u0442, \u0438\u0437 \u043d\u0438\u0445 18 \u043f\u0438\u0448\u0443 \u043d\u0430 Java.<\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e\u0431 \u043e\u043f\u044b\u0442\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u0442\u044d\u043a\u0430 \u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 NIO \u0432 Java.<\/p>\n<p>\u042d\u0442\u0430  \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0431\u043e\u0440\u044c\u0431\u044b \u0441 &#171;OutOfMemory: direct  memory&#187; \u0432 \u0448\u0438\u043d\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u0413\u0440\u0443\u043f\u043f\u0430 Platform Core, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0436\u0443, \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438 \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435\u043c <a href=\"https:\/\/bercut.com\/products\/hybrid-integration-platform\/\" rel=\"noopener noreferrer nofollow\">\u0433\u0438\u0431\u0440\u0438\u0434\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b<\/a>, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435.<\/p>\n<p>\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f:<\/p>\n<ul>\n<li>\n<p>\u0428\u0438\u043d\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 ESB.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f  API Gateway, SLES (\u0441\u0435\u0440\u0432\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432), SA Container  (\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u043d\u0430 Java), Notification Broker.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b: Scheduler, Service Profile Management \u0438 \u043f\u0440\u043e\u0447\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441\u043e Spring.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0432\u0438\u0433\u043b\u0438 \u0437\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b.<\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u0438\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Bercut<\/h2>\n<p>\u041d\u0430\u0448\u0430 \u0433\u0438\u0431\u0440\u0438\u0434\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u044e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u0443\u044e  \u0448\u0438\u043d\u0443 (RTSIB). \u042d\u0442\u043e ESB (<em>enterprise service bus)<\/em> \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b SOA (<em>service-oriented architecture<\/em>) \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0441\u0442\u0435\u043a\u0430\u043c\u0438 HTTP \u0438 \u043f\u0440\u043e\u043f\u0440\u0438\u0435\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 RTSIB.<\/p>\n<p>\u041f\u043e \u0441\u0432\u043e\u0435\u0439 \u0441\u0443\u0442\u0438 \u044d\u0442\u043e mesh-\u0441\u0435\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0443\u0437\u043b\u0430\u043c\u0438 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b.<\/p>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435  RTSIB \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438 &#8212; \u0447\u0438\u0442\u0430\u044e\u0449\u0438\u043c \u0438 \u043f\u0438\u0448\u0443\u0449\u0438\u043c, \u043f\u0440\u0438  \u044d\u0442\u043e\u043c \u043f\u0438\u0448\u0443\u0449\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0432 \u0438\u0433\u0440\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438, \u0430 \u0441\u043e\u043a\u0435\u0442 \u0437\u0430\u043d\u044f\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0441\u043e\u043a\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u0435\u043d \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u043e\u043a\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u044f\u043c\u043e \u0441 \u043f\u043e\u0442\u043e\u043a\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p>HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f (\u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c  \u0432\u0435\u0440\u0441\u0438\u044e 1.x) \u0432 \u0432\u0438\u0434\u0443 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430  \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043a\u0438 \u0434\u043b\u044f \u043d\u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043f\u0443\u043b\u0430 &#8212; \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u043d\u0430 25 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u043a\u0430\u043a \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043c\u044b \u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0437\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0447\u0442\u043e \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0441\u043e\u043a\u0435\u0442\u0430\u043c\u0438.<\/p>\n<h2>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u0435\u0442\u044c\u044e TCP\/IP \u0432 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0432 Java<\/h2>\n<p>\u041a\u0442\u043e \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u0442\u0435\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u043e\u043a\u0435\u0442 \u043d\u0430 Java \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043b\u044e\u0431\u0438\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b JDK, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u0437\u043d\u0430\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u043a\u0435\u0442\u043e\u043c, \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0435\u0449\u0451 \u0440\u0430\u0437 \u0438\u0445 \u043f\u0440\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c.<\/p>\n<p>\u0418\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432\u00a0Open JDK 13 (\u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f  \u0432\u0435\u0440\u0441\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0443 \u043d\u0430\u0441 Java) \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u0439 ByteBuffer \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f DirectByteBuffer, \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0440\u0430\u0437\u0443  (writeFromNativeBuffer), \u0430 \u0435\u0441\u043b\u0438 \u043e\u043d \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d \u0432 Heap, \u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 DirectByteBuffer, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c  \u0438\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e DirectByteBuffer.<\/p>\n<p>\u041a\u043e\u0434 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0441\u043e\u043a\u0435\u0442 \u0438\u0437 Open JDK 13 ( <em>IOUtil.java <\/em>):<\/p>\n<pre><code class=\"java\">static int write(FileDescriptor fd, ByteBuffer src, long position,                  boolean directIO, int alignment, NativeDispatcher nd)     throws IOException {     if (src instanceof DirectBuffer) {         return writeFromNativeBuffer(fd, src, position, directIO, alignment, nd);     }       \/\/ Substitute a native buffer     int pos = src.position();     int lim = src.limit();     assert (pos &lt;= lim);     int rem = (pos &lt;= lim ? lim - pos : 0);     ByteBuffer bb;     if (directIO) {         Util.checkRemainingBufferSizeAligned(rem, alignment);         bb = Util.getTemporaryAlignedDirectBuffer(rem, alignment);     } else {         bb = Util.getTemporaryDirectBuffer(rem);     }     try {         bb.put(src);         bb.flip();         \/\/ Do not update src until we see how many bytes were written         src.position(pos);           int n = writeFromNativeBuffer(fd, bb, position, directIO, alignment, nd);         if (n > 0) {             \/\/ now update src             src.position(pos + n);         }         return n;     } finally {         Util.offerFirstTemporaryDirectBuffer(bb);     } }<\/code><\/pre>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0442\u043e, \u0447\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 JDK \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u041a\u042d\u0428 DirectByteBuffer \u0441 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u043e\u0439 \u043a \u043f\u043e\u0442\u043e\u043a\u0443 (ThreadLocal):<\/p>\n<pre><code class=\"java\">private static ThreadLocal&lt;BufferCache> bufferCache = new TerminatingThreadLocal&lt;>() {     @Override     protected BufferCache initialValue() {         return new BufferCache();     }     @Override     protected void threadTerminated(BufferCache cache) { \/\/ will never be null         while (!cache.isEmpty()) {             ByteBuffer bb = cache.removeFirst();             free(bb);         }     } };   public static ByteBuffer getTemporaryDirectBuffer(int size) {     \/\/ If a buffer of this size is too large for the cache, there     \/\/ should not be a buffer in the cache that is at least as     \/\/ large. So we'll just create a new one. Also, we don't have     \/\/ to remove the buffer from the cache (as this method does     \/\/ below) given that we won't put the new buffer in the cache.     if (isBufferTooLarge(size)) {         return ByteBuffer.allocateDirect(size);     }       BufferCache cache = bufferCache.get();     ByteBuffer buf = cache.get(size);     if (buf != null) {         return buf;     } else {         \/\/ No suitable buffer in the cache so we need to allocate a new         \/\/ one. To avoid the cache growing then we remove the first         \/\/ buffer from the cache and free it.         if (!cache.isEmpty()) {             buf = cache.removeFirst();             free(buf);         }         return ByteBuffer.allocateDirect(size);     } }<\/code><\/pre>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e DirectByteBuffer, \u043e\u043d \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u041a\u042d\u0428. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432 \u041a\u042d\u0428\u0435 \u043d\u0435\u0442 DirectByteBuffer \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043e\u043d \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u041a\u042d\u0428 ( Util.offerFirstTemporaryDirectBuffer(bb) ).<\/p>\n<h2>\u0421\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/h2>\n<p>\u0412 \u043f\u0435\u0440\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 HeapByteBuffer \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e static-\u0444\u0443\u043d\u043a\u0446\u0438\u044e ByteBuffer.wrap(byte[] data) \u0438 \u0431\u0435\u0434 \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0435 \u0437\u043d\u0430\u043b\u0438.<\/p>\n<p>\u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u0430\u044f  \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0438\u0445 telecom-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435, \u043d\u043e \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0434\u0435\u043d\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 DWH (<em>Data Warehouse<\/em>), \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448\u0443 \u0448\u0438\u043d\u0443 \u0434\u043e\u0441\u0442\u0438\u0433 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u0432 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0430\u0445 \u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 OOM Direct Memory.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e? \u0410 \u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443: \u043a\u0430\u043a \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u0432\u044b\u0448\u0435, \u043c\u044b \u0438\u043c\u0435\u0435\u043c mesh-\u0441\u0435\u0442\u044c \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0438\u043c\u0435\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u0438 \u043f\u043e\u0442\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 off-heap \u043f\u0430\u043c\u044f\u0442\u044c \u0432 ThreadLocal \u041a\u042d\u0428\u0438 \u044d\u0442\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432. \u0414\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f  off-heap \u043f\u0430\u043c\u044f\u0442\u0438\u00a0 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c OOM. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c \u0431\u044b\u043b\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 JVM &#171;-XX:MaxDirectMemorySize&#187;. \u0420\u0430\u0437\u043c\u0435\u0440  \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 direct \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u0435\u0449\u0451. \u042d\u0442\u043e  \u0441\u0442\u0430\u043b\u043e \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0437\u0432\u043e\u043d\u043e\u0447\u043a\u043e\u043c, \u0447\u0442\u043e \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u043d\u0430\u0434\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435.<\/p>\n<h2>\u0410\u043d\u0430\u043b\u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0441\u043e\u0437\u043d\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043f\u0443\u0442\u0435\u0439 \u0435\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 \u043d\u0430\u0448\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u041f\u0438\u0441\u0430\u0442\u044c \u0432 \u0446\u0438\u043a\u043b\u0435 \u0431\u043b\u043e\u043a\u0430\u043c\u0438, \u0441\u0434\u0432\u0438\u0433\u0430\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e position \u0438 limit \u0432 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u043c  ByteBuffer. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043c\u043e\u0447\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 IOUtils \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 DirectByteBuffer \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c size = limit &#8212; position.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 ByteBuffer.allocateDirect().<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043d\u0430\u0440\u0435\u0437\u043a\u0443 \u0438\u0437 ByteBuffer \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0433\u0434\u0435 ByteBuffer \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438\u0437 \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0443\u043b\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0433\u0440\u0443\u0436\u0430\u044f\u0441\u044c \u0432\u0441\u0451 \u0433\u043b\u0443\u0431\u0436\u0435 \u0432  \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 ByteBuffer \u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430.<\/p>\n<p>\u0417\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442 4 \u0432\u0438\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u043a\u0435\u0442\u043e\u043c:<\/p>\n<ul>\n<li>\n<p>\u0410\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 HeapByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0410\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 DirectByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 HeapByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 DirectByteBuffer \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438\/\u0447\u0442\u0435\u043d\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412  \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0430\u0440\u0448\u0430\u043b\u043b\u0438\u043d\u0433 (\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438), \u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0447\u0442\u0435\u043d\u0438\u044e \u0438\u0437 \u0441\u043e\u043a\u0435\u0442\u0430 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ByteBuffer.<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u043a\u0442\u043e \u0436\u0435\u043b\u0430\u0435\u0442 \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0441\u044f \u0441 \u043d\u0438\u043c\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/agapitov-prog\/nio-test\" rel=\"noopener noreferrer nofollow\">Github<\/a>.<\/p>\n<p>\u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0442\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043e 1Mb \u0441\u0430\u043c\u044b\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044f DirectByteBuffer. \u0410\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044f HeapByteBuffer \u0447\u0435\u0440\u0435\u0437 wrap \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 HeapByteBuffer \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0432\u043d\u044b \u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043b\u0438\u0434\u0435\u0440\u0441\u0442\u0432\u043e\u043c \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e. \u0418\u0437 \u043e\u0431\u0449\u0435\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0432\u044b\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 DirectByteBuffer, \u0447\u0442\u043e \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043e\u043d \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0430 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442.<\/p>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 3 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b: \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u043d\u0430\u0440\u0435\u0437\u043a\u0443 \u0438\u0437 DirectByteBuffer \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u0449\u0438\u0439 \u043f\u0443\u043b. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 (\u0440\u0430\u0437\u043c\u0435\u0440 DirectByteBuffer) \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 32Kb \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u043f\u0438\u043a \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043d\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438. \u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0438 \u0441\u0442\u044d\u043a HTTPs, \u0444\u0430\u0431\u0440\u0438\u043a\u0430 \u043c\u043e\u0436\u0435\u0442  \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u0438 \u043f\u0443\u043b \u0441 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0442 32Kb \u0440\u0430\u0437\u043c\u0435\u0440\u0430\u043c\u0438 DirectByteBuffer, \u043e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043d\u0430 PacketBufferSize \u0438 ApplicationBufferSize \u0438\u0437 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 SSLEngine.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043b\u043e\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u043e\u0439 CompositeBuffer, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0438 Input\/Output streams, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 CompositeBuffer. \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f  \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043b\u043e\u044f marshalling\/unmarshalling.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0443\u0436\u0435 \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 DirectByteBuffer \u0441\u0434\u0435\u043b\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u0442\u044d\u043a \u043d\u0430 CAS \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0435:<\/p>\n<pre><code class=\"java\">public class CasStack&lt;L extends LinkedObject&lt;L>> {       public interface LinkedObject&lt;L extends LinkedObject> {               public L getNext();                   public void setNext(L next);               }       private final AtomicReference&lt;L> head = new AtomicReference&lt;>();       public void add(L lo) {         for (;;) {             lo.setNext(head.get());             if (head.compareAndSet(lo.getNext(), lo)) {                 return;             }         }     }       public L poll() {         L lo;         for (;;) {             lo = head.get();             if (lo == null) {                 return null;             }             if (head.compareAndSet(lo, lo.getNext())) {<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-355391","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/355391","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=355391"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/355391\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=355391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=355391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=355391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}