{"id":410212,"date":"2024-06-29T21:14:56","date_gmt":"2024-06-29T21:14:56","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=410212"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=410212","title":{"rendered":"<span>\u041a\u0430\u043a \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u0441 Python \u043d\u0430 Go \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u0410\u0432\u0438\u0442\u043e<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u0441\u0438\u043b\u0438\u0439 \u041a\u043e\u043f\u044b\u0442\u043e\u0432, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0436\u0443 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u0432 \u0410\u0432\u0438\u0442\u043e. \u041c\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u00a0\u0441\u0430\u0439\u0442\u0435 \u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u0441 Python \u043d\u0430 Go, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0451 \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0434\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Python.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fb\/a1e\/767\/3fba1e767f82d0d7d19ed4b52dd78b64.JPG\" width=\"1560\" height=\"880\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0410\u0432\u0438\u0442\u043e\u00a0<\/h3>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0448\u0451\u043b \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0430\u0439\u0442\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u0438\u0434\u0438\u0442 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043b\u0435\u043d\u0442\u0443 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u2014 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438. \u041d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u043d\u0430\u0448 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 representation, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u043b\u0435\u043d\u0442\u044b \u0430\u0439\u0442\u0435\u043c\u043e\u0432 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439, \u043f\u043e\u0440\u044f\u0434\u043a\u0430 200 000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443. \u0412\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0437\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c\u0438 \u2014 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 500 000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2bc\/f5a\/1c9\/2bcf5a1c9631401a6229273483d5a792.png\" alt=\"\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\" title=\"\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\" width=\"1039\" height=\"537\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2bc\/f5a\/1c9\/2bcf5a1c9631401a6229273483d5a792.png\"\/><figcaption>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435<\/figcaption><\/figure>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 representation \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437 100 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 (\u0430\u0439\u0442\u0435\u043c\u043e\u0432) \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0441\u0435\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446.<\/p>\n<p>Representation \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u0442\u0430\u043a\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443:<\/p>\n<ol>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0437 \u043d\u0435\u0433\u043e \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u044b.\u00a0<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u044b \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0438 \u043f\u043e\u0434\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0435\u0442\u0441\u043a\u0430\u044f \u043e\u0434\u0435\u0436\u0434\u0430, \u0442\u043e\u0432\u0430\u0440\u044b \u0434\u043b\u044f \u0440\u0443\u043a\u043e\u0434\u0435\u043b\u0438\u044f \u0438\u043b\u0438 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0435 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0435.\u00a0<\/p>\n<ol start=\"2\">\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u044b, \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c ML-\u043c\u043e\u0434\u0435\u043b\u044f\u043c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f<\/p>\n<\/li>\n<\/ol>\n<p>ML-\u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u2014 \u044d\u0442\u043e \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 4 \u0442\u0430\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0430\u0439\u0442\u0435\u043c\u044b \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a id (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0430\u0439\u0442\u0435\u043c\u043e\u0432).<\/p>\n<ol start=\"3\">\n<li>\n<p>\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c id \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 3000 \u0430\u0439\u0442\u0435\u043c\u043e\u0432 \u043d\u0430 \u043e\u0434\u0438\u043d \u0430\u043a\u043a\u0430\u0443\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2014 representation \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 CatBoost \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u043e\u0442 ML-\u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432 realtime.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u043e\u0442\u043e\u0432\u044f\u0442\u0441\u044f \u0444\u0438\u0447\u0438 \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e id \u0430\u0439\u0442\u0435\u043c\u0430 \u0438\u0434\u0451\u043c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (1 TB \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 Redis). \u0414\u0430\u043d\u043d\u044b\u0435 \u0430\u0439\u0442\u0435\u043c\u0430 \u2014 title, \u0446\u0435\u043d\u0430 \u0438 \u0435\u0449\u0451 \u043e\u043a\u043e\u043b\u043e 50 \u043f\u043e\u043b\u0435\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0444\u0438\u0447\u0438 \u0438 \u0430\u0439\u0442\u0435\u043c\u044b \u0432 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 CatBoost. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043b\u0435\u043d\u0442\u0443 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 representation \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043b\u0435\u043d\u0442\u0435 \u0442\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u043b\u0430\u0447\u0435\u043d\u043e \u043f\u0440\u0435\u043c\u0438\u0443\u043c-\u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 (boost VAS).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0434\u0430\u0451\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043b\u0435\u043d\u0442\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0432 \u043d\u0435\u0439 \u043e\u043a\u043e\u043b\u043e 3000 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d1d\/6b4\/cba\/d1d6b4cbaff8b031453b3845b27c6704.png\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0435\u043d\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439\u00a0\" title=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0435\u043d\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439\u00a0\" width=\"1144\" height=\"891\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d1d\/6b4\/cba\/d1d6b4cbaff8b031453b3845b27c6704.png\"\/><figcaption>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0435\u043d\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439\u00a0<\/figcaption><\/figure>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 <\/h2>\n<p>Representation \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0410\u0432\u0438\u0442\u043e. \u041e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 200 000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443. \u0421\u0435\u0440\u0432\u0438\u0441 \u0441\u0442\u0430\u043b \u0442\u0430\u043a\u0438\u043c \u043d\u0435 \u0441\u0440\u0430\u0437\u0443: \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u0430 Avito. \u041d\u0430\u043c \u0441\u0442\u0430\u043b\u043e \u0442\u044f\u0436\u0435\u043b\u043e \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043d\u0451\u043c, \u0432 \u0447\u0430\u0441\u044b \u043f\u0438\u043a, \u0438\u0437-\u0437\u0430 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u2014 \u0432 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u043e \u0441\u0432\u043e\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/428\/9d7\/8c6\/4289d78c6086eb7d2b5af64da14405d9.png\" alt=\"\u041a\u0430\u0440\u0442\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0410\u0432\u0438\u0442\u043e. \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e CPU \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\" title=\"\u041a\u0430\u0440\u0442\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0410\u0432\u0438\u0442\u043e. \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e CPU \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441\" width=\"992\" height=\"804\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/428\/9d7\/8c6\/4289d78c6086eb7d2b5af64da14405d9.png\"\/><figcaption>\u041a\u0430\u0440\u0442\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0410\u0432\u0438\u0442\u043e. \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e CPU \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441<\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0440\u043e\u0441\u043b\u043e \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0438\u043a\u043e\u0432\u044b\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u0436\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0434\u043e 1,6 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u2014 \u044d\u0442\u043e 8-\u043c\u0438 \u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u0433\u043e\u0434\u0430. \u0412\u0441\u0451 \u044d\u0442\u043e \u043c\u043e\u0433\u043b\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u044b \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b:\u00a0<\/p>\n<ol>\n<li>\n<p>\u0411\u043e\u043b\u044c\u0448\u0430\u044f IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u0412 representation \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 20 \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u2014 \u0431\u043b\u043e\u043a\u043e\u0432 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u0442 realtime \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 CPU, \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>GIL-representation \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c Python. \u041d\u0430 \u044d\u0442\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c IO-bound \u0438 CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.\u00a0<\/p>\n<\/li>\n<\/ol>\n<h3>\u041a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0436\u0438\u0442\u044c \u043f\u043e\u0434 \u043d\u0430\u0448\u0438\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438 \u043d\u0430 Python:<\/p>\n<h4>1. ProcessPoolExecutor<\/h4>\n<p>ProcessPoolExecutor \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u043b \u0438\u0437 \u044f\u0434\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u2014 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0434\u0440\u0435. \u0412 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043d\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435.\u00a0<\/p>\n<p>\u0412 representation \u043c\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 ProcessPoolExecutor, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c CPU-bound \u0438 IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0438\u0442\u043e\u043d\u044f\u0447\u044c\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0441\u0435\u0442\u0438 (IO-bound) \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0442\u0440\u0438 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u00a0 \u0434\u043b\u044f ML-\u043c\u043e\u0434\u0435\u043b\u0438 (CPU-bound).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e4a\/c38\/054\/e4ac380546d40a07b031db829d2f7848.png\" width=\"1132\" height=\"706\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e4a\/c38\/054\/e4ac380546d40a07b031db829d2f7848.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 aiohttp, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439. ProcessPoolExecutor \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043f\u0443\u043b \u0438\u0437 \u044f\u0434\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u2014 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u042d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0434\u0440\u0435. \u0412 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043d\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0432\u043b\u0438\u044f\u043b\u0430 \u043d\u0430 latency \u0432\u0441\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430.\u00a0<\/p>\n<p>\u0412\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ProcessPoolExecutor \u043e\u043a\u043e\u043b\u043e 35%. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0438 ProcessPoolExecutor. \u0422\u043e \u0435\u0441\u0442\u044c IO-bound \u0438 CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/712\/1d8\/5f1\/7121d85f13046051c8208ef8cb86cf7e.png\" alt=\"\u0411\u0435\u0437 ProcessPoolExecutor \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u043e \u043d\u0430 35%, \u0442\u0443\u0442 \u0438 \u043d\u0438\u0436\u0435 \u0432\u0441\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 95 perc.\" title=\"\u0411\u0435\u0437 ProcessPoolExecutor \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u043e \u043d\u0430 35%, \u0442\u0443\u0442 \u0438 \u043d\u0438\u0436\u0435 \u0432\u0441\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 95 perc.\" width=\"547\" height=\"397\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/712\/1d8\/5f1\/7121d85f13046051c8208ef8cb86cf7e.png\"\/><figcaption>\u0411\u0435\u0437 ProcessPoolExecutor \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u043e \u043d\u0430 35%, \u0442\u0443\u0442 \u0438 \u043d\u0438\u0436\u0435 \u0432\u0441\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 95 perc.<\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"python\">async def process_request(user_id):     # I\/O task     async with session.post(feature_service_url,                             json={'user_id': user_id}) as resp:         features = await resp.json()      return features<\/code><\/pre>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0445\u044d\u043d\u0434\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 async await \u2014 \u044d\u0442\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0442\u043e\u0447\u043a\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d.\u00a0<\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u043f\u044f\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043a\u043e\u0434\u0430 \u043e\u0434\u043d\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0441\u044b\u043f\u0430\u0435\u0442 \u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0430 Python \u0442\u0430\u043a\u043e\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"python\">def predict(features)     preprocessed_features = processor.preprocess(features)     return model.infer(preprocessed_features)       async def process_request(user_id):     # I\/O task     async with session.post(feature_service_url,                             json={'user_id': user_id}) as resp:         features = await resp.json()     # blocking CPU task   return predict(features)<\/code><\/pre>\n<p>\u0412\u0434\u0440\u0443\u0433 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0442 ML-\u043c\u043e\u0434\u0435\u043b\u0438. \u0418 \u0432\u043e\u0442 \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 12 \u043d\u0430\u0448\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u0438\u0442\u043e\u043d\u044f\u0447\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u0432\u0441\u0442\u0430\u043b\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0435 \u0432\u044b\u0440\u043e\u0441\u043b\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code class=\"python\">executor = concurrent.futures.ProcessPoolExecutor(man_workers=N)       def predict(features):     preprocessed_features = processor.preprocess(features)     return model.infer(preprocessed_features)           async def process_request(user_id):     # I\/O task     async with session.post(feature_service_url,                             json={'user_id': user_id}) as resp:         features = await resp.json()     # Non blocking CPU task   return await loop.run_in_executor(executor, predict(features))<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f ProcessPoolExecutor \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0443\u043b\u043e\u043c \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u041d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 1 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u043b. \u041d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 15 \u0431\u0435\u0440\u0435\u043c \u043e\u0442\u0442\u0443\u0434\u0430 \u0432\u043e\u0440\u043a\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c CPU-bound \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u044f\u0434\u0440\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f predict \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0438 \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 async-await, \u0438 CPU-bound \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 IO-bound \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438, \u043d\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0433\u0438\u044f \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438.<\/p>\n<p>ProcessPoolExecutor \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043d\u0430\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043e\u0432\u0435\u0440\u0445\u0435\u0434 \u043e\u0442 realtime ML-\u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e \u0434\u0430\u0436\u0435 \u0441 \u043d\u0438\u043c \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0442\u0430\u043b\u043e \u043f\u043b\u043e\u0445\u043e. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0438 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u2014 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0438\u0441\u043a \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442.\u00a0\u00a0<\/p>\n<h4>2. \u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043f\u043e\u0438\u0441\u043a \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442<\/h4>\n<p>\u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0438\u0448\u0443\u0442 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u2014 \u0432 \u043d\u0451\u043c \u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0430 \u043a\u0430\u043a\u0438\u0435 \u0431\u044b\u0441\u0442\u0440\u043e, \u043c\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430 <a href=\"https:\/\/github.com\/benfred\/py-spy\">py-spy<\/a>.\u00a0<\/p>\n<p>\u041f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 \u0441\u0442\u0440\u043e\u0438\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u043e\u0441\u044b \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e 3 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0430 \u0441\u043f\u0440\u0430\u0432\u0430. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0448\u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u0444\u0438\u0447\u0435\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cb4\/70d\/9b9\/cb470d9b97ea2800b08f3c8009d9da34.png\" width=\"1600\" height=\"806\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cb4\/70d\/9b9\/cb470d9b97ea2800b08f3c8009d9da34.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e flame \u0433\u0440\u0430\u0444\u0443 \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438:\u00a0<\/p>\n<ul>\n<li>\n<p>7% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0442\u0440\u0430\u0442\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438. \u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0439\u0442\u044b. \u0412 Python \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f pickle, \u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 \u2014\u00a0 unpickle.<\/p>\n<\/li>\n<li>\n<p>3% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b ProcessPoolExecutor \u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043f\u0443\u043b\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>6,7% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 json.loads \u0438 json.dumps.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043d\u043e\u0432\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0438 ProcessPoolExecutor, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/9b2\/312\/36f\/9b231236f87cb9a246cce7d6c8296f1d.jpg\" alt=\"\u0411\u0435\u0437 ProcessPoolExecutor \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043d\u0435\u0442 \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u0430 \u043d\u0430 pickle\/unpickle \u0438 IO-wait \" title=\"\u0411\u0435\u0437 ProcessPoolExecutor \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043d\u0435\u0442 \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u0430 \u043d\u0430 pickle\/unpickle \u0438 IO-wait \" width=\"1025\" height=\"561\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b2\/312\/36f\/9b231236f87cb9a246cce7d6c8296f1d.jpg\" data-blurred=\"true\"\/><figcaption>\u0411\u0435\u0437 ProcessPoolExecutor \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043d\u0435\u0442 \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u0430 \u043d\u0430 pickle\/unpickle \u0438 IO-wait <\/figcaption><\/figure>\n<p>\u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u2014 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043d\u043e \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u0442\u0430\u043b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/a77\/5c9\/3a5\/a775c93a5e6be3184e084404bcc79d19.jpg\" width=\"1280\" height=\"469\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a77\/5c9\/3a5\/a775c93a5e6be3184e084404bcc79d19.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b ProcessPoolExecutor \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 100 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<li>\n<p>IO-bound \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u043e\u0436\u0438\u0434\u0430\u044e\u0442 80 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0443\u0441\u043d\u0443\u043b\u0430 \u0438 EventLoop \u0434\u043e \u043d\u0435\u0435 \u0434\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u043e\u0432\u044c \u0447\u0435\u0440\u0435\u0437 80 ms, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0412 representation \u0442\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b IO-bound \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u2014 \u0438\u0442\u043e\u0433\u043e 240 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 IO-wait.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0443\u0442 \u043c\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Go, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043d\u0435\u043c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0448\u0435\u0434\u0443\u043b\u0438\u043d\u0433\u0430 \u0440\u0443\u0442\u0438\u043d.<\/p>\n<h4>3. \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438 CPU-bound \u0438 IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 2 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h4>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438, \u2014 \u0443\u0431\u0440\u0430\u0442\u044c ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 rec-ranker. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441 representation, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0430 \u0441\u043a\u043e\u0440\u0438\u043d\u0433 ML-\u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u044b\u043b \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 rec-ranker, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b\u0438 \u0441\u043a\u043e\u0440\u044b \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0447\u0443\u0442\u044c \u0441\u043d\u0438\u0437\u0438\u043c latency \u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0435 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ddc\/3bf\/33d\/ddc3bf33dfa5f18874550327b75dc44d.png\" width=\"1190\" height=\"706\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ddc\/3bf\/33d\/ddc3bf33dfa5f18874550327b75dc44d.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043b: \u043c\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0435 \u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u0432 270 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u0435\u0442\u0438 \u0438 json.loads\/json.dumps. \u041d\u0430 \u043e\u0434\u0438\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 4 \u041c\u0431, \u0430 \u0434\u043b\u044f \u043e\u0447\u0435\u043d\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u2014 \u0434\u043e 12 \u041c\u0431 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f ML-\u043c\u043e\u0434\u0435\u043b\u0438. \u041f\u043e\u0441\u043b\u0435 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043f\u043b\u0438\u043a rec-ranker \u0441\u0442\u0430\u043b\u043e \u043d\u0435 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0443 \u0441\u0442\u0430\u0440\u043e\u0433\u043e representation, \u0430 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u043e\u0441\u044c. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0435\u0439\u0441\u0430 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0432\u0435\u0440\u043d\u0443\u043b\u0438\u0441\u044c \u043a \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 representation.<\/p>\n<h4>4. \u041e\u0446\u0435\u043d\u0438\u043b\u0438 Shared Memory<\/h4>\n<p>\u0412 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 representation \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 pickle\/unpickle. \u0412\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0435\u043b\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u043e\u0431\u0449\u0438\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043f\u0430\u043c\u044f\u0442\u0438. \u0422\u0430\u043a \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u0441\u044f \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041f\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0446\u0435\u043d\u043a\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 70 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043d\u0430 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0442\u0430\u043a \u043a\u0430\u043a pickle\/unpickle \u2014 CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 Python-\u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439. \u042d\u0442\u043e\u0442 \u0432\u044b\u0432\u043e\u0434 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0430: pickle\/unpickle \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 7% \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u0442\u0430 \u043e\u0442 shared memory \u043c\u044b \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u044b.<\/p>\n<h4>5. \u0421\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0444\u0438\u0447\u0435\u0439 \u043d\u0430 Go<\/h4>\n<p>\u041c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c Go \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0441\u0430\u043c\u0443\u044e \u0442\u044f\u0436\u0435\u043b\u0443\u044e CPU-bound \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0444\u0438\u0447\u0435\u0439.\u00a0<\/p>\n<p>\u0424\u0438\u0447\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u0439\u0442\u0435\u043c\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f, \u0446\u0435\u043d\u0430, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0445 \u0438 \u043a\u043b\u0438\u043a\u0430\u0445. \u0412\u0441\u0435\u0433\u043e \u043e\u043a\u043e\u043b\u043e 60 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b ML-\u043c\u043e\u0434\u0435\u043b\u0438. \u0422\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f 3000 \u0430\u0439\u0442\u0435\u043c\u043e\u0432 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043c\u043e\u0434\u0435\u043b\u044c, \u0430 \u043e\u043d\u0430 \u043e\u0442\u0434\u0430\u0435\u0442 \u0441\u043a\u043e\u0440 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u0440\u0430\u043d\u0436\u0438\u0440\u0443\u0435\u043c \u043b\u0435\u043d\u0442\u0443.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 Go \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0444\u0438\u0447\u0435\u0439 \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 Python, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 ctypes.<\/p>\n<pre><code class=\"python\">def get_predictions(   raw_data: bytes,   model_ptr: POINTER(c_void_p),   size: int, ) -> list:   raw_predictions = lib.GetPredictionsWithModel(     GoString(raw_data, len(raw_data)),     model_ptr,   )   predictions = [raw_predictions[i] for i in range(size)]   return predictions<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 Python. \u041c\u043e\u0434\u0443\u043b\u044c lib \u2014 \u044d\u0442\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0433\u043e\u0448\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f GetPredictionsWithModel. \u0412 \u043d\u0435\u0451 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0431\u0430\u0439\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u0431 \u0430\u0439\u0442\u0435\u043c\u0430\u0445 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 ML-\u043c\u043e\u0434\u0435\u043b\u044c. \u0412\u0441\u0435 \u0444\u0438\u0447\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u0434\u043e\u043c \u043d\u0430 Go.<\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430\u0441 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0438\u043b\u0438:\u00a0<\/p>\n<ul>\n<li>\n<p>\u0444\u0438\u0447\u0438 \u043d\u0430 Go \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0432 20-30 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0435\u0441\u044c \u0448\u0430\u0433 \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0441\u044f \u0432 3 \u0440\u0430\u0437\u0430, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044f \u043b\u0438\u0448\u043d\u044e\u044e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0439\u0442\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043e\u0442\u0432\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0443\u043f\u0430\u043b \u043d\u0430 35%.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3c\/64d\/21c\/e3c64d21c92af249c89bd07a657a8dec.png\" alt=\"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u043d\u0430 Go \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0430\u0439\u0442\u0430 \u0441 1060 \u0434\u043e 680 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\" title=\"\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u043d\u0430 Go \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0430\u0439\u0442\u0430 \u0441 1060 \u0434\u043e 680 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\" width=\"716\" height=\"461\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e3c\/64d\/21c\/e3c64d21c92af249c89bd07a657a8dec.png\"\/><figcaption>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u043d\u0430 Go \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0430\u0439\u0442\u0430 \u0441 1060 \u0434\u043e 680 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434<\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/646\/f3f\/edc\/646f3fedc72142c144549d3695e70b7d.png\" alt=\"\u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u0444\u0438\u0447\u0435\u0439. \u0422\u0443\u0442 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Go \u0443 \u043d\u0430\u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c ProcessPoolExecutor\" title=\"\u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u0444\u0438\u0447\u0435\u0439. \u0422\u0443\u0442 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Go \u0443 \u043d\u0430\u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c ProcessPoolExecutor\" width=\"1600\" height=\"878\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/646\/f3f\/edc\/646f3fedc72142c144549d3695e70b7d.png\"\/><figcaption>\u0412\u0440\u0435\u043c\u044f \u043d\u0430 \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u0444\u0438\u0447\u0435\u0439. \u0422\u0443\u0442 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Go \u0443 \u043d\u0430\u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043c\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c ProcessPoolExecutor<\/figcaption><\/figure>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0432\u044b\u0432\u043e\u0434\u0430:\u00a0<\/p>\n<ol>\n<li>\n<p>\u0424\u0438\u0447\u0438 \u043d\u0430 Go \u0434\u043b\u044f 3000 \u0430\u0439\u0442\u0435\u043c\u043e\u0432 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0432 20-30 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0442\u043e \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 30% \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<li>\n<p>ProcessPoolExecutor \u0442\u0440\u0430\u0442\u0438\u0442 \u043e\u043a\u043e\u043b\u043e 10% \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b IO-bound-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 25% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043f\u0443\u0441\u0442\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043d\u0430 Go \u043c\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 65% \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<\/li>\n<\/ol>\n<h2>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u0441\u0451 \u043d\u0430 Go<\/h2>\n<p>\u0412 representation-go \u0435\u0441\u0442\u044c ML-\u043c\u043e\u0434\u0435\u043b\u044c. \u041d\u0430\u0442\u0438\u0432\u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0447\u0442\u043e ML \u0434\u0440\u0443\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 Python, \u043d\u043e \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0430 CatBoost \u0438 \u0443 \u043d\u0435\u0435 \u0435\u0441\u0442\u044c API, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0437 Go. \u042d\u0442\u0438\u043c \u043c\u044b \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c.\u00a0<\/p>\n<p>\u041d\u0438\u0436\u0435 \u043a\u0443\u0441\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430 \u0432 Go. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043d\u0430 \u043d\u0451\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0431\u0443\u0434\u0443, \u043e\u0442\u043c\u0435\u0447\u0443 \u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e \u0438\u043d\u0444\u0435\u0440\u0435\u043d\u0441 \u0434\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u043a\u0430\u043a \u0432 Python. <strong>C<\/strong> \u2014 \u043f\u0441\u0435\u0432\u0434\u043e\u043f\u0430\u043a\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 Go \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438 \u043d\u0430 C.<\/p>\n<pre><code class=\"go\">if !C.CalcModelPrediction(       model.Handler,       C.size_t(nSamples),       floatsC,       C.size_t(floatFeaturesCount),       catsC,       C.size_t(categoryFeaturesCount),       (*C.double)(&amp;results[0]),       C.size_t(nSamples), ) {       return nil, getError() }<\/code><\/pre>\n<p>\u0415\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 ML-\u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e \u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 Python. \u0418 \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u043b\u0430\u0441\u044c \u0438 \u0441\u043a\u043e\u0440\u0438\u043b\u0430\u0441\u044c \u043d\u0430 \u043e\u0434\u043d\u0438\u0445 \u0438 \u0442\u0435\u0445 \u0436\u0435 \u0444\u0438\u0447\u0430\u0445, \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u043d\u0435 \u0440\u0430\u0437\u044a\u0435\u0445\u0430\u043b\u0438\u0441\u044c.\u00a0<\/p>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u043c\u044b \u0441\u0442\u0430\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0434\u0430 Go-\u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0442\u0443\u0434\u0430 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0430 Go, \u0444\u0438\u0447\u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b, \u043f\u043e\u0442\u043e\u043c Python-\u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0438 \u043e\u0431\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u043d\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044c. \u041a\u0430\u043a \u0431\u043e\u043d\u0443\u0441? \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u043e\u0436\u0435 \u0441\u0442\u0430\u043b\u043e \u0432 20-30 \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>Representation-go \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:\u00a0<\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0443\u043f\u0430\u043b \u0432 3 \u0440\u0430\u0437\u0430 \u0441 1280 \u0434\u043e 450 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 CPU \u0443\u043f\u0430\u043b\u043e \u0432 5 \u0440\u0430\u0437.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 RAM \u0441\u043d\u0438\u0437\u0438\u043b\u043e\u0441\u044c \u0432 21 \u0440\u0430\u0437.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4d2\/b34\/87e\/4d2b3487e2af36c415ffaaba18ece5d6.png\" alt=\"\u0412\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432\" title=\"\u0412\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432\" width=\"838\" height=\"503\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4d2\/b34\/87e\/4d2b3487e2af36c415ffaaba18ece5d6.png\"\/><figcaption>\u0412\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432<\/figcaption><\/figure>\n<p>\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u2014 \u043c\u043e\u0436\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c <em>\u0442\u044f\u0436\u0435\u043b\u044b\u0435<\/em> \u0444\u0438\u0447\u0438.<\/p>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 Python \u043d\u0430 Go<\/h3>\n<p>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434 \u043d\u0430 Go \u0434\u0430\u043b \u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u0430 \u043e\u043f\u044b\u0442\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u043c\u044b \u0432\u044b\u0432\u0435\u043b\u0438 \u0442\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 Go:\u00a0<\/p>\n<ol>\n<li>\n<p>\u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u043c\u043d\u043e\u0433\u043e CPU-bound-\u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438;\u00a0<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0436\u0435 \u043c\u043d\u043e\u0433\u043e IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e \u0441\u0435\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0444\u0438\u0447\u0435\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430 Python. \u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0435 \u043d\u0430 Go \u0432\u044b \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0432\u044b\u0438\u0433\u0440\u0430\u0435\u0442\u0435 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0447\u0442\u043e \u043f\u0440\u0438 \u043c\u0430\u043b\u044b\u0445 \u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445 \u043d\u0435 \u0442\u0430\u043a \u0432\u0430\u0436\u043d\u043e.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0431\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043d\u043e \u043f\u043e \u0441\u0435\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a \u0443 \u043d\u0430\u0441, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:<\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c ProcessPoolExecutor. \u041d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438, \u043f\u043e\u043a\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u0433\u0438\u0433\u0430\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u2014 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 2 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ol>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430, c \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0447\u0430\u0442\u044c<\/h2>\n<p>\u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u0443\u0439\u0442\u0435 \u0432\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <a href=\"https:\/\/github.com\/benfred\/py-spy\">py-spy<\/a>, \u043a\u0430\u043a \u043c\u044b, \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 Python. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435 \u043d\u0435\u0442 \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0445 \u043d\u0435\u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u0432. \u041d\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0451\u043c \u0434\u043b\u044f \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a py-spy \u0432 \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435:\u00a0<\/p>\n<p><code>record -F -o record.svg -s --nonblocking -p 1<\/code><\/p>\n<p>\u042d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 flame, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439. \u0427\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435 \u0442\u0443\u0442 \u0431\u0440\u043e\u0441\u0438\u043b\u043e\u0441\u044c \u0432 \u0433\u043b\u0430\u0437\u0430 \u2014 \u0437\u0430\u043c\u0435\u0442\u043d\u044b\u0439 \u043a\u0443\u0441\u043e\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u043d\u0430 json \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0443\u0436\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0435\u0451 \u0443\u0431\u0440\u0430\u043b\u0438. \u0415\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c json loads\/dumps \u0432\u0441\u0435\u0445 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 orjson.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7c5\/7ad\/a7b\/7c57ada7b992b607c669be1912a43d8a.png\" width=\"1526\" height=\"866\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7c5\/7ad\/a7b\/7c57ada7b992b607c669be1912a43d8a.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0443 \u0438 \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0434\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0432\u0435\u0442\u043e\u0432:<\/p>\n<ol>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 request validator \u0441 \u0443\u043c\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 orjson \u0434\u043b\u044f Python \u0438\u043b\u0438 jsoniter \u0434\u043b\u044f Golang.<\/p>\n<\/li>\n<li>\n<p>\u0423\u043c\u0435\u043d\u044c\u0448\u0430\u0439\u0442\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u0441\u0435\u0442\u044c \u2014 \u0436\u043c\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u044b\u0435(zstd). \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0439\u0442\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414 (Protobuf\/MessagePack). \u0418\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0441\u0436\u0430\u0442\u044c, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438 \u0440\u0430\u0437\u0436\u0430\u0442\u044c, \u0447\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u0436\u0430\u0442\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435. <\/p>\n<\/li>\n<li>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e.<\/p>\n<\/li>\n<\/ol>\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\/679560\/\"> https:\/\/habr.com\/ru\/articles\/679560\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u0441\u0438\u043b\u0438\u0439 \u041a\u043e\u043f\u044b\u0442\u043e\u0432, \u044f \u0440\u0443\u043a\u043e\u0432\u043e\u0436\u0443 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u0432 \u0410\u0432\u0438\u0442\u043e. \u041c\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u00a0\u0441\u0430\u0439\u0442\u0435 \u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445. \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u043e\u0433\u0434\u0430 \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u0441 Python \u043d\u0430 Go, \u0430 \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0451 \u043a\u0430\u043a \u0435\u0441\u0442\u044c. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0434\u0430\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043d\u0430 Python.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0410\u0432\u0438\u0442\u043e\u00a0<\/h3>\n<p>\u041b\u044e\u0431\u043e\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0448\u0451\u043b \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441\u0430\u0439\u0442\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u0438\u0434\u0438\u0442 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u043b\u0435\u043d\u0442\u0443 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u2014 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438. \u041d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u043d\u0430\u0448 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 representation, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u043b\u0435\u043d\u0442\u044b \u0430\u0439\u0442\u0435\u043c\u043e\u0432 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439, \u043f\u043e\u0440\u044f\u0434\u043a\u0430 200 000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443. \u0412\u0435\u0441\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u0437\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f\u043c\u0438 \u2014 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 500 000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443.<\/p>\n<figure class=\"full-width\"><figcaption>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435<\/figcaption><\/figure>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 representation \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0437 100 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 (\u0430\u0439\u0442\u0435\u043c\u043e\u0432) \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u0441\u0435\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043c\u0435\u0441\u044f\u0446.<\/p>\n<p>Representation \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u0442\u0430\u043a\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443:<\/p>\n<ol>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0437 \u043d\u0435\u0433\u043e \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u044b.\u00a0<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u044b \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0438 \u043f\u043e\u0434\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0447\u0435\u043b\u043e\u0432\u0435\u043a. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u0435\u0442\u0441\u043a\u0430\u044f \u043e\u0434\u0435\u0436\u0434\u0430, \u0442\u043e\u0432\u0430\u0440\u044b \u0434\u043b\u044f \u0440\u0443\u043a\u043e\u0434\u0435\u043b\u0438\u044f \u0438\u043b\u0438 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0435 \u0436\u0438\u0432\u043e\u0442\u043d\u044b\u0435.\u00a0<\/p>\n<ol start=\"2\">\n<li>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u044b, \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c ML-\u043c\u043e\u0434\u0435\u043b\u044f\u043c \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f<\/p>\n<\/li>\n<\/ol>\n<p>ML-\u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u2014 \u044d\u0442\u043e \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b. \u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 4 \u0442\u0430\u043a\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0438. \u041e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0430\u0439\u0442\u0435\u043c\u044b \u043f\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043e\u0442 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a id (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0430\u0439\u0442\u0435\u043c\u043e\u0432).<\/p>\n<ol start=\"3\">\n<li>\n<p>\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c id \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 3000 \u0430\u0439\u0442\u0435\u043c\u043e\u0432 \u043d\u0430 \u043e\u0434\u0438\u043d \u0430\u043a\u043a\u0430\u0443\u043d\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u2014 representation \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 CatBoost \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439 \u043e\u0442 ML-\u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0432 realtime.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u043e\u0442\u043e\u0432\u044f\u0442\u0441\u044f \u0444\u0438\u0447\u0438 \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e id \u0430\u0439\u0442\u0435\u043c\u0430 \u0438\u0434\u0451\u043c \u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (1 TB \u0448\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 Redis). \u0414\u0430\u043d\u043d\u044b\u0435 \u0430\u0439\u0442\u0435\u043c\u0430 \u2014 title, \u0446\u0435\u043d\u0430 \u0438 \u0435\u0449\u0451 \u043e\u043a\u043e\u043b\u043e 50 \u043f\u043e\u043b\u0435\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0444\u0438\u0447\u0438 \u0438 \u0430\u0439\u0442\u0435\u043c\u044b \u0432 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 CatBoost. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0442\u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043b\u0435\u043d\u0442\u0443 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043b\u0435\u0435 representation \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043b\u0435\u043d\u0442\u0435 \u0442\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u043b\u0430\u0447\u0435\u043d\u043e \u043f\u0440\u0435\u043c\u0438\u0443\u043c-\u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 (boost VAS).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0434\u0430\u0451\u043c \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043b\u0435\u043d\u0442\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0432 \u043d\u0435\u0439 \u043e\u043a\u043e\u043b\u043e 3000 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><figcaption>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0435\u043d\u0442\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439\u00a0<\/figcaption><\/figure>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439 <\/h2>\n<p>Representation \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0432 \u0410\u0432\u0438\u0442\u043e. \u041e\u043d \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 200 000 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443. \u0421\u0435\u0440\u0432\u0438\u0441 \u0441\u0442\u0430\u043b \u0442\u0430\u043a\u0438\u043c \u043d\u0435 \u0441\u0440\u0430\u0437\u0443: \u043c\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u043b\u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439. \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u043d \u043d\u0430\u0447\u0430\u043b \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u0430 Avito. \u041d\u0430\u043c \u0441\u0442\u0430\u043b\u043e \u0442\u044f\u0436\u0435\u043b\u043e \u0432\u044b\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043d\u0451\u043c, \u0432 \u0447\u0430\u0441\u044b \u043f\u0438\u043a, \u0438\u0437-\u0437\u0430 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u2014 \u0432 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u043e \u0441\u0432\u043e\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b.\u00a0<\/p>\n<figure class=\"full-width\"><figcaption>\u041a\u0430\u0440\u0442\u0430 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0410\u0432\u0438\u0442\u043e. \u0420\u0430\u0437\u043c\u0435\u0440 \u043a\u0440\u0443\u0433\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e CPU \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441<\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0440\u043e\u0441\u043b\u043e \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0438\u043a\u043e\u0432\u044b\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0433 \u0436\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438 \u0434\u043e 1,6 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u2014 \u044d\u0442\u043e 8-\u043c\u0438 \u043a\u0440\u0430\u0442\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 2 \u0433\u043e\u0434\u0430. \u0412\u0441\u0451 \u044d\u0442\u043e \u043c\u043e\u0433\u043b\u043e \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0443\u044e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439.<\/p>\n<p>\u041f\u0440\u0438\u0447\u0438\u043d\u044b \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b:\u00a0<\/p>\n<ol>\n<li>\n<p>\u0411\u043e\u043b\u044c\u0448\u0430\u044f IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u0412 representation \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 20 \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u2014 \u0431\u043b\u043e\u043a\u043e\u0432 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043e\u0442 realtime \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 CPU, \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>GIL-representation \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c Python. \u041d\u0430 \u044d\u0442\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c IO-bound \u0438 CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.\u00a0<\/p>\n<\/li>\n<\/ol>\n<h3>\u041a\u0430\u043a \u043c\u044b \u0440\u0435\u0448\u0430\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0439<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u0436\u0438\u0442\u044c \u043f\u043e\u0434 \u043d\u0430\u0448\u0438\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438 \u043d\u0430 Python:<\/p>\n<h4>1. ProcessPoolExecutor<\/h4>\n<p>ProcessPoolExecutor \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043f\u0443\u043b \u0438\u0437 \u044f\u0434\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u2014 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0434\u0440\u0435. \u0412 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043d\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435.\u00a0<\/p>\n<p>\u0412 representation \u043c\u044b \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 ProcessPoolExecutor, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c CPU-bound \u0438 IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0438\u0442\u043e\u043d\u044f\u0447\u044c\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0445\u043e\u0434\u0438\u0442 \u043f\u043e \u0441\u0435\u0442\u0438 (IO-bound) \u043c\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0442\u0440\u0438 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u00a0 \u0434\u043b\u044f ML-\u043c\u043e\u0434\u0435\u043b\u0438 (CPU-bound).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 aiohttp, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439. ProcessPoolExecutor \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043f\u0443\u043b \u0438\u0437 \u044f\u0434\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u2014 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u042d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0434\u0440\u0435. \u0412 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043d\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u0432\u043b\u0438\u044f\u043b\u0430 \u043d\u0430 latency \u0432\u0441\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441\u0430.\u00a0<\/p>\n<p>\u0412\u044b\u0438\u0433\u0440\u044b\u0448 \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f ProcessPoolExecutor \u043e\u043a\u043e\u043b\u043e 35%. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0438 ProcessPoolExecutor. \u0422\u043e \u0435\u0441\u0442\u044c IO-bound \u0438 CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435.<\/p>\n<figure class=\"full-width\"><figcaption>\u0411\u0435\u0437 ProcessPoolExecutor \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u043e \u043d\u0430 35%, \u0442\u0443\u0442 \u0438 \u043d\u0438\u0436\u0435 \u0432\u0441\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 95 perc.<\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432 \u043a\u043e\u0434\u0435:<\/p>\n<pre><code class=\"python\">async def process_request(user_id):     # I\/O task     async with session.post(feature_service_url,                             json={'user_id': user_id}) as resp:         features = await resp.json()      return features<\/code><\/pre>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0445\u044d\u043d\u0434\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 async await \u2014 \u044d\u0442\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0442\u043e\u0447\u043a\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d.\u00a0<\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430 \u043f\u044f\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043a\u043e\u0434\u0430 \u043e\u0434\u043d\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0441\u044b\u043f\u0430\u0435\u0442 \u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0435, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0436\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u041d\u0430 Python \u0442\u0430\u043a\u043e\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043c\u043d\u043e\u0433\u043e\u0437\u0430\u0434\u0430\u0447\u043d\u043e\u0441\u0442\u044c.<\/p>\n<pre><code class=\"python\">def predict(features)     preprocessed_features = processor.preprocess(features)     return model.infer(preprocessed_features)       async def process_request(user_id):     # I\/O task     async with session.post(feature_service_url,                             json={'user_id': user_id}) as resp:         features = await resp.json()     # blocking CPU task   return predict(features)<\/code><\/pre>\n<p>\u0412\u0434\u0440\u0443\u0433 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c CPU-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043e\u0442 ML-\u043c\u043e\u0434\u0435\u043b\u0438. \u0418 \u0432\u043e\u0442 \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 12 \u043d\u0430\u0448\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u0438\u0442\u043e\u043d\u044f\u0447\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u0432\u0441\u0442\u0430\u043b\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438 \u0432\u0440\u0435\u043c\u044f \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0435 \u0432\u044b\u0440\u043e\u0441\u043b\u043e, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0440\u0430\u043d\u0435\u0435.<\/p>\n<pre><code class=\"python\">executor = concurrent.futures.ProcessPoolExecutor(man_workers=N)       def predict(features):     preprocessed_features = processor.preprocess(features)     return model.infer(preprocessed_features)           async def process_request(user_id):     # I\/O task     async with session.post(feature_service_url,                             json={'user_id': user_id}) as resp:         features = await resp.json()     # Non blocking CPU task   return await loop.run_in_executor(executor, predict(features))<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f ProcessPoolExecutor \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043f\u0443\u043b\u043e\u043c \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u041d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 1 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0443\u043b. \u041d\u0430 \u0441\u0442\u0440\u043e\u043a\u0435 15 \u0431\u0435\u0440\u0435\u043c \u043e\u0442\u0442\u0443\u0434\u0430 \u0432\u043e\u0440\u043a\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c CPU-bound \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u044f\u0434\u0440\u043e. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044f predict \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443 \u0438 \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e. \u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0435, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u043e \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 async-await, \u0438 CPU-bound \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043d\u0430\u0440\u0430\u0432\u043d\u0435 \u0441 IO-bound \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438, \u043d\u043e \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043c\u0430\u0433\u0438\u044f \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438.<\/p>\n<p>ProcessPoolExecutor \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u043d\u0430\u043c \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043e\u0432\u0435\u0440\u0445\u0435\u0434 \u043e\u0442 realtime ML-\u043c\u043e\u0434\u0435\u043b\u0438, \u043d\u043e \u0434\u0430\u0436\u0435 \u0441 \u043d\u0438\u043c \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0442\u0430\u043b\u043e \u043f\u043b\u043e\u0445\u043e. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0438 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u2014 \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0438\u0441\u043a \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442.\u00a0\u00a0<\/p>\n<h4>2. \u041f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043f\u043e\u0438\u0441\u043a \u0443\u0437\u043a\u0438\u0445 \u043c\u0435\u0441\u0442<\/h4>\n<p>\u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0438\u0448\u0443\u0442 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u2014 \u0432 \u043d\u0451\u043c \u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0430 \u043a\u0430\u043a\u0438\u0435 \u0431\u044b\u0441\u0442\u0440\u043e, \u043c\u044b \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440\u0430 <a href=\"https:\/\/github.com\/benfred\/py-spy\">py-spy<\/a>.\u00a0<\/p>\n<p>\u041f\u0440\u043e\u0444\u0430\u0439\u043b\u0435\u0440 \u0441\u0442\u0440\u043e\u0438\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u043e\u0441\u044b \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0442\u0440\u0430\u0442\u0438\u0442 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e 3 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u0430 \u0441\u043f\u0440\u0430\u0432\u0430. \u042d\u0442\u043e \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u0448\u0438 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0434\u043b\u044f \u0441\u043a\u043e\u0440\u0438\u043d\u0433\u0430 \u0444\u0438\u0447\u0435\u0439 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e flame \u0433\u0440\u0430\u0444\u0443 \u043c\u044b \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438:\u00a0<\/p>\n<ul>\n<li>\n<p>7% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0442\u0440\u0430\u0442\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438. \u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043f\u0435\u0440\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0439\u0442\u044b. \u0412 Python \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f pickle, \u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 \u2014\u00a0 unpickle.<\/p>\n<\/li>\n<li>\n<p>3% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b ProcessPoolExecutor \u2014 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043f\u0443\u043b\u0430 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p>6,7% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 json.loads \u0438 json.dumps.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043d\u043e\u0432\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u0438 ProcessPoolExecutor, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.\u00a0<\/p>\n<figure class=\"full-width\"><figcaption>\u0411\u0435\u0437 ProcessPoolExecutor \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0451 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u0438\u0447\u0435\u0439 \u0438 \u0441\u043a\u043e\u0440\u0438\u043d\u0433 ML-\u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043d\u0435\u0442 \u043e\u0432\u0435\u0440\u0445\u0435\u0434\u0430 \u043d\u0430 pickle\/unpickle \u0438 IO-wait <\/figcaption><\/figure>\n<p>\u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u2014 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430 \u0441\u0442\u0430\u043b \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u043d\u043e \u0441\u0430\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u0442\u0430\u043b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b ProcessPoolExecutor \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 100 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<li>\n<p>IO-bound \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u043e\u0436\u0438\u0434\u0430\u044e\u0442 80 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u0442\u043e \u0435\u0441\u0442\u044c \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0443\u0441\u043d\u0443\u043b\u0430 \u0438 EventLoop \u0434\u043e \u043d\u0435\u0435 \u0434\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u043e\u0432\u044c \u0447\u0435\u0440\u0435\u0437 80 ms, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0412 representation \u0442\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0433\u0440\u0443\u043f\u043f\u044b IO-bound \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u2014 \u0438\u0442\u043e\u0433\u043e 240 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 IO-wait.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0443\u0442 \u043c\u044b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Go, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u043d\u0435\u043c \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0448\u0435\u0434\u0443\u043b\u0438\u043d\u0433\u0430 \u0440\u0443\u0442\u0438\u043d.<\/p>\n<h4>3. \u0420\u0430\u0437\u0434\u0435\u043b\u0438\u043b\u0438 CPU-bound \u0438 IO-bound \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 2 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h4>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b\u0438, \u2014 \u0443\u0431\u0440\u0430\u0442\u044c ML-\u043c\u043e\u0434\u0435\u043b\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 rec-ranker. \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0438\u0441<\/p>\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-410212","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/410212","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=410212"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/410212\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=410212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=410212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=410212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}