{"id":482914,"date":"2026-06-09T07:12:11","date_gmt":"2026-06-09T07:12:11","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=482914"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=482914","title":{"rendered":"\u041a\u0430\u043a \u043c\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u0438 \u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0439 \u0432 45 \u0440\u0430\u0437: \u0441 6 \u043c\u0438\u043d\u0443\u0442 \u0434\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u043a\u0443\u043d\u0434"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041a \u043c\u0430\u044e 2026 \u0433\u043e\u0434\u0430 \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u043b 2 \u0447\u0430\u0441\u0430 50 \u043c\u0438\u043d\u0443\u0442. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u041f\u0435\u0440\u0432\u0430\u044f: 96.5% \u044d\u0442\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0442\u043e\u044f\u043b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0412\u0442\u043e\u0440\u0430\u044f: \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0434\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0440\u0430\u0441\u0447\u0451\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u043b 6 \u043c\u0438\u043d\u0443\u0442 \u2014 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447 \u0432\u043d\u0443\u0442\u0440\u0438 DAG \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0432 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0441\u0442\u0440\u043e\u043a, \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0431\u044b\u043b\u0438 JOIN.<\/p>\n<p>\u041c\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043b\u0438 \u043e\u0431\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 20 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0440\u0430\u0437\u0431\u0438\u0442\u044b\u0445 \u043d\u0430 \u0448\u0435\u0441\u0442\u044c \u044d\u0442\u0430\u043f\u043e\u0432. \u041d\u0438\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<p>\u0412\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u00ab\u0434\u043e\u00bb \u0438 \u00ab\u043f\u043e\u0441\u043b\u0435\u00bb \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043f\u043e Postgres \u2014 \u044d\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u0437\u0430\u043c\u0435\u0440.<\/p>\n<p>\u0414\u043e\u043c\u0435\u043d \u043e\u0431\u043e\u0431\u0449\u0451\u043d: \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0431\u0443\u043b\u0435\u0432\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c (\u00ab\u0442\u0440\u0430\u0442\u044b &gt; 5000 \u20bd \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 3 \u043c\u0435\u0441\u044f\u0446\u0430\u00bb \u0418 \u00ab\u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 <em>\u0420\u0435\u0441\u0442\u043e\u0440\u0430\u043d\u044b<\/em>\u00bb) \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0437 <strong>10-\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u043e\u0439<\/strong> \u0431\u0430\u0437\u044b \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<h3>\u0413\u043b\u043e\u0441\u0441\u0430\u0440\u0438\u0439<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0422\u0435\u0440\u043c\u0438\u043d<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0410\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f (\u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0439. \u00ab\u0421\u043e\u0431\u0440\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e\u00bb \u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0440\u0443\u0436\u0443.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>DAG<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0444 \u0437\u0430\u0434\u0430\u0447: \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0436\u0434\u0451\u0442, \u043f\u043e\u043a\u0430 \u0434\u043e\u0441\u0447\u0438\u0442\u0430\u044e\u0442 \u0444\u0438\u043d\u0430\u043d\u0441\u044b \u0438 \u0433\u0435\u043e.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>TQ (\u0434\u0432\u0438\u0436\u043e\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u0447)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u0432\u0435\u0440\u0445 Postgres: \u0445\u0440\u0430\u043d\u0438\u0442 \u0433\u0440\u0430\u0444, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0440\u0435\u0442\u0440\u0430\u0438 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u0412\u043e\u0440\u043a\u0435\u0440<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0437\u0430\u0434\u0430\u0447\u0438: <code>FINANCIAL<\/code> \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440, <code>HASH<\/code> \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0445\u0435\u0448\u0438, <code>INTERSECT<\/code> \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0430\u044f \u0421\u0423\u0411\u0414<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0410\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041f\u0440\u043e\u0446\u0435\u0441\u0441 vs \u0437\u0430\u0434\u0430\u0447\u0430<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0434\u0438\u043d \u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u2014 \u043e\u0434\u0438\u043d <strong>\u043f\u0440\u043e\u0446\u0435\u0441\u0441<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 <strong>\u0437\u0430\u0434\u0430\u0447<\/strong> (\u0443\u0437\u043b\u043e\u0432 DAG).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><strong>\u041e\u0447\u0435\u0440\u0435\u0434\u044c (queue) vs \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (exec)<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0436\u0434\u0451\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0442\u0430 (<strong>queue<\/strong>), \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f (<strong>exec<\/strong>).<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0412\u043e\u0440\u043a\u0435\u0440<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>FINANCIAL<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c: \u0441\u0443\u043c\u043c\u0430 \u0442\u0440\u0430\u0442, \u0434\u043e\u0445\u043e\u0434\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434. \u0421\u0430\u043c\u044b\u0439 \u0442\u044f\u0436\u0451\u043b\u044b\u0439.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>HASH<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0444\u0430\u0439\u043b \u0445\u0435\u0448\u0435\u0439 (SHA512 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432, MD5 \u043f\u043e\u0447\u0442) \u0441 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u0431\u0430\u0437\u0435.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>MCC<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e \u043a\u043e\u0434\u0430\u043c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a (merchant category codes).<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>INTERSECT<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0442\u043e\u043a: \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>UNION<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0439\u0442\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0438\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>SUBTRACT<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0445 \u0432 \u0441\u0442\u043e\u043f-\u043b\u0438\u0441\u0442.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>DELTA_AUDITORY<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u043e\u0439 \u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u0435.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>EXPORT<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 Kafka \/ S3.<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>CLEAN_UP<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>1. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430<\/h3>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445: REST-\u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u0432\u0438\u0436\u043e\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u0447 (TQ), \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0430\u044f \u0421\u0423\u0411\u0414 \u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (Kafka + S3).<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9a2\/3db\/680\/9a23db6802c467e7315ab863ff1e4433.png\" width=\"1568\" height=\"164\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9a2\/3db\/680\/9a23db6802c467e7315ab863ff1e4433.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9a2\/3db\/680\/9a23db6802c467e7315ab863ff1e4433.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 <strong>\u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u043a\u0430\u043a DAG<\/strong>. \u041f\u043e\u0434 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0433\u0440\u0430\u0444 \u0437\u0430\u0434\u0430\u0447, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 Postgres \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c\u0438. DAG \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c (\u0444\u0438\u043d\u0430\u043d\u0441\u044b \u0438 \u0433\u0435\u043e \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e), \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0436\u0434\u0451\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u0435\u0442\u043e\u043a). \u042d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u044b \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 \u2014 \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0441\u0430\u043b\u0438\u0441\u044c \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432\u043e\u043a\u0440\u0443\u0433.<\/p>\n<h4>\u0421\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u043f\u0443\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438<\/h4>\n<p>\u0413\u0440\u0430\u0444 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f DSL:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/073\/a3c\/aac\/073a3caacd4b835237634c62816f3947.png\" width=\"1568\" height=\"2088\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/073\/a3c\/aac\/073a3caacd4b835237634c62816f3947.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/073\/a3c\/aac\/073a3caacd4b835237634c62816f3947.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<pre><code class=\"kotlin\">tqueue(type = \"AUDITORY_GATHERING\", continuous = true, priority = 1) {    val fin  = task&lt;FinancialParams, SetResult&gt;(\"FINANCIAL\")  { params { \/* \u043f\u0435\u0440\u0438\u043e\u0434, \u043f\u043e\u0440\u043e\u0433 *\/ } }    val mcc  = task&lt;MccParams, SetResult&gt;(\"MCC\")              { params { \/* \u043a\u043e\u0434\u044b, \u043f\u0435\u0440\u0438\u043e\u0434 *\/ } }    val hash = task&lt;HashParams, SetResult&gt;(\"HASH\")            { params { \/* \u0444\u0430\u0439\u043b \u0445\u0435\u0448\u0435\u0439 *\/ } }    val intersect = task&lt;IntersectParams, SetResult&gt;(\"INTERSECT\") {        dependsOn(fin, mcc, hash)    }    val export = task&lt;ExportParams, Unit&gt;(\"EXPORT\") { dependsOn(intersect) }    task&lt;CleanUpParams, Unit&gt;(\"CLEAN_UP\") { dependsOn(export) }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>\u0426\u0438\u043a\u043b \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f<\/h4>\n<p>\u041a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u043b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<pre><code>\u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434:  1. \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438  2. \u0441\u0442\u043e\u0440\u043e\u0436: \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c TIMEOUT \u043f\u0440\u043e\u0441\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438  3. \u0441\u0442\u043e\u0440\u043e\u0436: \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c TIMEOUT \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0442\u0430\u0440\u044b\u0435 NEW  4. \u0441\u0442\u043e\u0440\u043e\u0436: \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u0430\u0446\u0438\u0438  5. \u0440\u0430\u0437\u0434\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 + \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043d\u043e\u0434\u0443  6. \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0451\u043d\u043d\u044b\u0435 \u044d\u0442\u043e\u0439 \u043d\u043e\u0434\u0435 \u0437\u0430\u0434\u0430\u0447\u0438  7. \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c: IN_PROGRESS \u2192 \u0432\u043e\u0440\u043a\u0435\u0440 \u2192 \u0443\u0441\u043f\u0435\u0445\/\u043e\u0448\u0438\u0431\u043a\u0430<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432 \u0448\u0430\u0433\u0430\u0445 1\u20134 \u2014 \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c <em>\u0434\u043e<\/em> \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u0430 \u0434\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<h4>\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0420\u0435\u043f\u043b\u0438\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">2<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">CPU \/ \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u0440\u0435\u043f\u043b\u0438\u043a\u0443<\/p>\n<\/td>\n<td>\n<p align=\"left\">500m \/ 2 GiB (JVM <code>-Xmx<\/code> 1 GiB)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>5<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414<\/p>\n<\/td>\n<td>\n<p align=\"left\">7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u043f\u0440\u043e\u0441\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">5 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0431\u043e\u0440\u043e\u0432<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u043a\u0430\u0436\u0434\u044b\u0435 15 \u0441<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u042d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0442 \u0431\u00f3\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u2014 \u043b\u0438\u043c\u0438\u0442 \u0432 5 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<h3>2. \u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430<\/h3>\n<h4>\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0447\u0438\u0441\u043b\u0430<\/h4>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u2014 \u043d\u0438 Grafana-\u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430, \u043d\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0435\u0441\u044c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u0432 Postgres: \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 <code>tq_process<\/code> \u0438 <code>tq_task<\/code> \u0435\u0441\u0442\u044c <code>date_created<\/code> (\u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c), <code>date_started<\/code> (\u0432\u0437\u044f\u0442\u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u0443) \u0438 <code>date_finished<\/code> (\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430). \u042d\u0442\u0438\u0445 \u0442\u0440\u0451\u0445 \u043c\u0435\u0442\u043e\u043a \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"sql\">SELECT    type AS process_type,    COUNT(*) AS total_runs,    ROUND(AVG(EXTRACT(EPOCH FROM (date_finished - date_created)))) AS avg_total_sec,    ROUND(PERCENTILE_CONT(0.95) WITHIN GROUP (        ORDER BY EXTRACT(EPOCH FROM (date_finished - date_created)))) AS p95_total_sec,    ROUND(AVG(EXTRACT(EPOCH FROM (date_finished - date_started)))) AS avg_exec_sec,    ROUND(AVG(EXTRACT(EPOCH FROM (date_started  - date_created)))) AS avg_queue_secFROM tq_processWHERE date_created &gt;= NOW() - INTERVAL '14 days'  AND status = 'COMPLETED'GROUP BY type;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h4>2.1. 96.5% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th data-colwidth=\"148\" width=\"148\">\n<p align=\"left\">\u0422\u0438\u043f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0417\u0430\u043f\u0443\u0441\u043a\u043e\u0432<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041f\u043e\u043b\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (avg)<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (avg)<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 (avg)<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td data-colwidth=\"148\" width=\"148\">\n<p align=\"left\"><code>AUDITORY_GATHERING<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">3 765<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>10 229 \u0441<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">361 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>9 868 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"148\" width=\"148\">\n<p align=\"left\"><code>MATCHING_DELTA_EXCLUSION<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">16 800<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 939 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">1 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 938 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"148\" width=\"148\">\n<p align=\"left\"><code>OFFER_AUDITORY_LOADING<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">8 955<\/p>\n<\/td>\n<td>\n<p align=\"left\">8 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">2 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">6 \u0441<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/96b\/6a1\/437\/96b6a14379c6a72aea67cfac0c6b0f6f.png\" width=\"1274\" height=\"506\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/96b\/6a1\/437\/96b6a14379c6a72aea67cfac0c6b0f6f.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/96b\/6a1\/437\/96b6a14379c6a72aea67cfac0c6b0f6f.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0441\u0431\u043e\u0440 \u0448\u0451\u043b 2 \u0447\u0430\u0441\u0430 50 \u043c\u0438\u043d\u0443\u0442. \u0420\u0430\u0441\u0447\u0451\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u043b 6 \u043c\u0438\u043d\u0443\u0442. \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0412\u044b\u0432\u043e\u0434, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432\u0448\u0438\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e: \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f SQL \u0432 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u0445 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 3.5% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043d\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u043d\u0438\u0445.<\/p>\n<h4>2.2. \u041e\u0434\u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u0432\u0441\u0435\u0445<\/h4>\n<p>\u041b\u0438\u043c\u0438\u0442 \u00ab5 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u00bb \u0431\u044b\u043b \u043e\u0431\u0449\u0438\u043c \u043d\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0443\u0440. \u0420\u0430\u0437\u0431\u0440\u043e\u0441 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0422\u0438\u043f \u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (avg)<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 (avg)<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>FINANCIAL<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>198 \u0441<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">272 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>DELTA_AUDITORY<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">92 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>12 708 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>SUBTRACT<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">48 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">12 606 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>INTERSECT<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">38 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">10 610 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>HASH<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\">13 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">12 187 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><code>UNION<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>2 \u0441<\/strong><\/p>\n<\/td>\n<td>\n<p align=\"left\">12 146 \u0441<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/37a\/5ea\/a87\/37a5eaa872adb7922b59c3f12bc28e92.png\" width=\"1270\" height=\"646\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/37a\/5ea\/a87\/37a5eaa872adb7922b59c3f12bc28e92.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/37a\/5ea\/a87\/37a5eaa872adb7922b59c3f12bc28e92.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><code>FINANCIAL<\/code> (198 \u0441) \u0438 <code>UNION<\/code> (2 \u0441) \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0437\u0430 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u043f\u044f\u0442\u044c \u0441\u043b\u043e\u0442\u043e\u0432. \u0412\u044b\u0434\u0430\u0447\u0430 \u0437\u0430\u0434\u0430\u0447 \u2014 <code>ORDER BY priority, date_created<\/code> \u2014 \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u0430, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043c\u043e\u0433 \u0437\u0430\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u0441\u043b\u043e\u0442\u044b, \u043f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0436\u0434\u0430\u043b\u0438. \u041e\u0442\u0441\u044e\u0434\u0430 <code>queue \u2248 27 \u00d7 exec<\/code>.<\/p>\n<h4>2.3. \u041d\u043e\u0447\u043d\u0430\u044f \u0432\u043e\u043b\u043d\u0430<\/h4>\n<p>\u0412 22:00 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430 \u043c\u0430\u0441\u0441\u0443 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043e\u0432 \u2014 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0421\u0430\u043c\u044b\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u043e\u043a\u043e\u043b\u043e <code>22:00:40<\/code> \u0438 \u0436\u0434\u0430\u043b\u0438 \u0434\u043e <strong>32 000 \u0441\u0435\u043a\u0443\u043d\u0434<\/strong> (\u2248 9 \u0447\u0430\u0441\u043e\u0432). \u041a \u0433\u0440\u0430\u0444\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0434\u0435\u043b\u044c\u0442\u0430-\u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d3d\/3af\/5b9\/d3d3af5b9a695fb9f1875067bc8422d5.png\" width=\"1568\" height=\"390\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d3d\/3af\/5b9\/d3d3af5b9a695fb9f1875067bc8422d5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d3d\/3af\/5b9\/d3d3af5b9a695fb9f1875067bc8422d5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u0435\u043b\u044c\u0442\u0430-\u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c 92 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u2014 12 708 \u0441\u0435\u043a\u0443\u043d\u0434. \u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 138:1.<\/p>\n<h4>2.4. \u0423\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u0434\u0432\u0438\u0436\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/h4>\n<ul>\n<li>\n<p><strong>\u041e\u043f\u0440\u043e\u0441 \u043c\u0435\u0436\u0434\u0443 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 DAG.<\/strong> <code>delay(5s)<\/code> \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0433\u0440\u0430\u0444\u0430 \u0436\u0434\u0430\u043b \u0434\u043e 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0443\u0442\u0438.<\/strong> \u0422\u0440\u0438 <code>UPDATE<\/code>-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c <em>\u0434\u043e<\/em> \u0440\u0430\u0437\u0434\u0430\u0447\u0438 \u0437\u0430\u0434\u0430\u0447. \u0417\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u043e \u0441\u0442\u0430\u0440\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0435\u0437\u0435\u0440\u0432\u0430\u0446\u0438\u044f \u0432 \u0434\u0432\u0430 \u0448\u0430\u0433\u0430.<\/strong> \u0421\u043d\u0430\u0447\u0430\u043b\u0430 <code>node_id<\/code> (\u0441\u0442\u0430\u0442\u0443\u0441 <code>NEW<\/code>), \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e <code>IN_PROGRESS<\/code>. \u041c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u2014 \u043e\u043a\u043d\u043e <code>NEW + node_id<\/code>, \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0433\u043e\u043d\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e.<\/strong> <code>continuous = true<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u043b <code>UPDATE tq_task SET priority = -1<\/code> \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 <em>\u043a\u0430\u0436\u0434\u043e\u0433\u043e<\/em> \u0432\u043e\u0440\u043a\u0435\u0440\u0430. \u0414\u043b\u044f \u0433\u0440\u0430\u0444\u0430 \u0438\u0437 50 \u0437\u0430\u0434\u0430\u0447 \u2014 50 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 UPDATE.<\/p>\n<\/li>\n<li>\n<p><code><strong>NOT EXISTS<\/strong><\/code><strong> \u043f\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435.<\/strong> \u0413\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u043b\u0430\u0441\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0441\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u044b\u0441\u044f\u0447 \u0441\u0442\u0440\u043e\u043a <code>tq_task_dependencies<\/code> \u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<\/ul>\n<h4>2.5. \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u043b\u043a\u0430\u044f \u043d\u0430\u0440\u0435\u0437\u043a\u0430 DAG<\/h4>\n<p>\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u0430\u044f \u0432\u0435\u0442\u043a\u0430 \u0434\u0440\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0435\u0441\u044f\u0446\u0443 (\u0440\u0435\u0436\u0438\u043c <code>EACH_MONTH<\/code>), MCC \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0440\u0435\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430\u043c. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2f4\/38f\/5d1\/2f438f5d1d7d6139d8eafa8ea2709fe3.png\" width=\"1568\" height=\"398\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2f4\/38f\/5d1\/2f438f5d1d7d6139d8eafa8ea2709fe3.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2f4\/38f\/5d1\/2f438f5d1d7d6139d8eafa8ea2709fe3.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u043b\u044f 12 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u044d\u0442\u043e \u0434\u0430\u0432\u0430\u043b\u043e 16 TQ-\u0437\u0430\u0434\u0430\u0447 \u0438 3 \u0443\u0440\u043e\u0432\u043d\u044f DAG \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u0443\u044e \u0432\u0435\u0442\u043a\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u2014 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/p>\n<h4>2.6. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0447\u0451\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0440\u043e\u0438\u043b\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 DAG \u0441 \u043d\u0443\u043b\u044f. \u0421\u043e\u0442\u043d\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c\u0438 <code>FINANCIAL(\u044f\u043d\u0432\u0430\u0440\u044c, \u043f\u043e\u0440\u043e\u0433 5000)<\/code> \u2014 \u044d\u0442\u043e \u0441\u043e\u0442\u043d\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0443\u044e \u0421\u0423\u0411\u0414.<\/p>\n<h3>3. \u0420\u0435\u0448\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 20 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u043b\u043e\u044f\u043c. \u041d\u0438\u0436\u0435 \u2014 \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u2014 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0438 \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043b\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.<\/p>\n<h4>3.1. \u0420\u0435\u0441\u0443\u0440\u0441\u044b \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/h4>\n<h3>CPU throttling \u2192 2000m<\/h3>\n<p>Grafana \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0430 54 000+ throttled periods: JVM \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0430\u0441\u044c Kubernetes CFS-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 JDBI, \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0430 70\u201380% \u043e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438.<\/p>\n<pre><code class=\"yaml\"># k8s values \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435:resources:  limits:    cpu: 2000m    # \u0431\u044b\u043b\u043e 500m  requests:    cpu: 500m     # \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 \u2014 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 scheduling<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u043d\u0430 20\u201330%. \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 CPU limit \u043d\u0435 \u043d\u0435\u0441\u0451\u0442 \u0440\u0438\u0441\u043a\u0430.<\/p>\n<h3>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u0430 \u0438 \u043b\u0438\u043c\u0438\u0442\u043e\u0432<\/h3>\n<p>\u041f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414: 7 \u2192 15. <code>max-concurrent-tasks<\/code>: 5 \u2192 10. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u044f\u0432\u043d\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414 \u2014 \u0440\u0430\u043d\u0435\u0435 \u043e\u043d \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b.<\/p>\n<pre><code class=\"yaml\">database.clickhouse.datasource:  maximumPoolSize: 15    # \u0431\u044b\u043b\u043e 7tqueue:  max-concurrent-tasks: 10   # \u0431\u044b\u043b\u043e 5  queue-limits:    KAFKA: 2    CLICKHOUSE: 2    COLUMNAR_DB: 8           # \u043d\u043e\u0432\u044b\u0439 \u043b\u0438\u043c\u0438\u0442<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u043f\u043e \u0442\u0438\u043f\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438<\/h3>\n<p><code>FINANCIAL<\/code> (198 \u0441) \u0438 <code>UNION<\/code> (2 \u0441) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u0442\u043e\u044f\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438:<\/p>\n<pre><code class=\"yaml\">tqueue:  queue-limits:    HEAVY: 3       # FINANCIAL, AGGREGATION \u2014 \u0442\u044f\u0436\u0451\u043b\u0430\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430    LIGHT: 10      # INTERSECT, UNION, HASH, MCC \u2014 \u043b\u0451\u0433\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438    FILE_OP: 5     # EXPORT, CLEAN_UP \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438    AUTO_GATHER: 2 # \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d52\/c66\/fc8\/d52c66fc8147ab949e1f669647c58a62.png\" width=\"1568\" height=\"714\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d52\/c66\/fc8\/d52c66fc8147ab949e1f669647c58a62.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d52\/c66\/fc8\/d52c66fc8147ab949e1f669647c58a62.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<pre><code class=\"kotlin\">\/\/ FINANCIAL, FINANCIAL_AGGREGATION \u2192 HEAVYtask.queueType = \"HEAVY\"\/\/ INTERSECT, UNION, HASH, MCC \u2192 LIGHTtask.queueType = \"LIGHT\"\/\/ EXPORT, CLEAN_UP \u2192 FILE_OPtask.queueType = \"FILE_OP\"<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> <code>UNION<\/code> \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0436\u0434\u0430\u0442\u044c \u0437\u0430 <code>FINANCIAL<\/code>. \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c DAG \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u043d\u0430 15\u201320%.<\/p>\n<h4>3.2. \u0421\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<h3>Fair scheduling: ROW_NUMBER \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c<\/h3>\n<p>\u0421\u0442\u0430\u0440\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 <code>ORDER BY priority, date_created LIMIT 5<\/code> \u043e\u0442\u0434\u0430\u0432\u0430\u043b \u0432\u0441\u0435 \u0441\u043b\u043e\u0442\u044b \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u041d\u043e\u0432\u044b\u0439 \u0440\u0430\u043d\u0436\u0438\u0440\u0443\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0438 \u0440\u0430\u0437\u0434\u0430\u0451\u0442 \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"sql\">WITH ranked AS (  SELECT t.*,         ROW_NUMBER() OVER (             PARTITION BY t.process_id             ORDER BY t.priority NULLS LAST, t.date_created) AS rn  FROM tq_task t  WHERE t.status = 'NEW' AND t.node_id IS NULL    AND NOT EXISTS (\/* \u043d\u0435\u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 *\/)    AND EXISTS (\/* \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 *\/))SELECT * FROM rankedORDER BY rn, priority NULLS LAST, date_createdLIMIT :fetchLimit FOR UPDATE SKIP LOCKED<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3a\/b27\/199\/e3ab271996f61707ded944b86259542b.png\" width=\"1568\" height=\"1280\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/e3a\/b27\/199\/e3ab271996f61707ded944b86259542b.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3a\/b27\/199\/e3ab271996f61707ded944b86259542b.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> 9-\u0447\u0430\u0441\u043e\u0432\u043e\u0439 \u0445\u0432\u043e\u0441\u0442 \u0432 SLOW-\u0431\u0430\u043a\u0435\u0442\u0435 \u0438\u0441\u0447\u0435\u0437. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e <code>(status, node_id, process_id)<\/code>.<\/p>\n<h3>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432<\/h3>\n<pre><code class=\"yaml\">tqueue:  max-concurrent-processes-by-type:    AUDITORY_GATHERING: 5    # \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 5 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e 100 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u2014 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e 5, \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e.<\/p>\n<h4>3.3. \u0423\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u0434\u0432\u0438\u0436\u043a\u0430<\/h4>\n<h3>\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u2014 \u043e\u0434\u0438\u043d \u0440\u0430\u0437<\/h3>\n<p><code>UPDATE tq_task SET priority = -1<\/code> \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043d \u0438\u0437 <code>execute()<\/code> \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0414\u043b\u044f \u0433\u0440\u0430\u0444\u0430 \u0438\u0437 50 \u0437\u0430\u0434\u0430\u0447 \u2014 1 UPDATE \u0432\u043c\u0435\u0441\u0442\u043e 50.<\/p>\n<h3>\u0421\u0442\u043e\u0440\u043e\u0436 \u2014 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443<\/h3>\n<p>\u0422\u0440\u0438 \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u044b\u0445 <code>UPDATE<\/code>-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u0446\u0438\u043a\u043b \u0441 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u043c 60 \u0441\u0435\u043a\u0443\u043d\u0434:<\/p>\n<pre><code class=\"kotlin\">\/\/ \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0440\u0443\u0442\u0438\u043d, \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0434\u0430\u0447\u0443 \u0437\u0430\u0434\u0430\u0447:config.schedulingScope.launch {    while (isActive) {        delay(60.seconds)        tqTaskWatchdog.checkForTimeouts(config.taskExecutionTimeout)        tqTaskWatchdog.checkForStaleNewTasks(config.taskStaleNewTimeout)        tqTaskWatchdog.checkForStaleReservedTasks(config.taskReservationTimeout)    }}\/\/ \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0446\u0438\u043a\u043b \u2014 \u0442\u043e\u043b\u044c\u043a\u043e scheduling:while (isActive) {    recurringTaskService.runSchedulingIteration()    launchProcessingTasks()    delay(config.interval)}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>Shared Task: \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0432\u0441\u0435\u0445<\/h3>\n<p>\u0412 TQ \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435 <code>task_key = SHA256(type + canonical_params)<\/code>. \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u2014 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0430, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u043e\u0438\u043c:<\/p>\n<pre><code>tq_shared_task  id | task_key | owner_task_id | status | resulttq_task_shared_subscription  process_id | task_id | shared_task_id<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0432 <code>tq_task<\/code> \u043f\u0440\u0438 \u043d\u043e\u0447\u043d\u043e\u0439 \u0432\u043e\u043b\u043d\u0435 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u043a\u0440\u0430\u0442\u043d\u043e, \u043a\u043e\u043d\u043a\u0443\u0440\u0435\u043d\u0446\u0438\u044f \u0437\u0430 \u0441\u043b\u043e\u0442\u044b \u2014 \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e.<\/p>\n<h4>3.4. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c<\/h4>\n<h3>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 consumer \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438<\/h3>\n<p>Kafka consumer \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0431\u044b\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c: <code>FetchMessage \u2192 Consume (S3 + HTTP + DB, 10\u201330 \u0441) \u2192 CommitOffset \u2192 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439<\/code>. \u041f\u0440\u0438 \u043f\u0430\u0447\u043a\u0435 \u0438\u0437 10 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 22:00 \u044d\u0442\u043e \u0434\u0430\u0432\u0430\u043b\u043e 100\u2013300 \u0441\u0435\u043a\u0443\u043d\u0434 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043d \u043d\u0430 worker pool \u0438\u0437 N \u0433\u043e\u0440\u0443\u0442\u0438\u043d \u0441 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0435\u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9e5\/39d\/922\/9e539d92220a6df717a77a0ef5817766.png\" width=\"1568\" height=\"958\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9e5\/39d\/922\/9e539d92220a6df717a77a0ef5817766.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9e5\/39d\/922\/9e539d92220a6df717a77a0ef5817766.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<pre><code class=\"go\">jobs := make(chan kafkaMsg.Message[T], bufferSize)for i := 0; i &lt; workerCount; i++ {    go func() {        for msg := range jobs { consumer.Consume(msg) }    }()}\/\/ reader loop: FetchMessage \u2192 jobs \u2190 parseMessage\/\/ offset tracker: commit(min uncommitted offset)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> \u043f\u0430\u0447\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0432\u0440\u0435\u043c\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u043e\u043b\u0433\u043e\u0433\u043e, \u0430 \u043d\u0435 \u0441\u0443\u043c\u043c\u044b \u0432\u0441\u0435\u0445.<\/p>\n<h3>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c \u0434\u043b\u044f \u043f\u043e\u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0445 \u0441\u0431\u043e\u0440\u043e\u0432<\/h3>\n<p>\u0420\u0435\u0436\u0438\u043c <code>EACH_MONTH<\/code> \u043d\u0430 12 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b 16 TQ-\u0437\u0430\u0434\u0430\u0447 (12 FINANCIAL + 3 INTERSECT + 1 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439). \u0417\u0430\u043c\u0435\u043d\u0451\u043d \u043e\u0434\u043d\u0438\u043c \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u043c <code>FINANCIAL_MONTHLY_ALL<\/code> \u0441 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438 \u0438 \u0441\u0435\u043c\u0430\u0444\u043e\u0440\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">@Worker(\"FINANCIAL_MONTHLY_ALL\")class FinancialMonthlyAllWorker : TQWorker&lt;...&gt; {    override suspend fun run(task, tqApi) {        val semaphore = Semaphore(5)  \/\/ \u043d\u0435 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043f\u0443\u043b \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414        val monthResults = coroutineScope {            months.map { monthParams -&gt;                async(Dispatchers.IO) {                    semaphore.withPermit {    columnarRepository.gatherAuditory(fileId, monthParams)                    }                }            }.awaitAll()        }        val final = intersectionRepository.intersectViaBitmap(monthResults)        task.result = AuditoryGatheringResult(bitmapLocation = final, ...)    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c71\/227\/080\/c7122708078a88450e99213916a5d0db.png\" width=\"1568\" height=\"742\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/c71\/227\/080\/c7122708078a88450e99213916a5d0db.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c71\/227\/080\/c7122708078a88450e99213916a5d0db.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> 16 TQ-\u0437\u0430\u0434\u0430\u0447 \u2192 1 \u0437\u0430\u0434\u0430\u0447\u0430. 3 \u0443\u0440\u043e\u0432\u043d\u044f DAG \u2192 0. \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c: ~600 \u0441 \u2192 ~210 \u0441.<\/p>\n<h4>3.5. \u0411\u0430\u0442\u0447\u0438\u043d\u0433 \u0444\u043e\u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447<\/h4>\n<p><code>MATCHING_DELTA_EXCLUSION<\/code> \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b 16 800 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0437\u0430 \u0434\u0432\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u2014 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u043a\u0443\u043d\u0434\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 49 \u043c\u0438\u043d\u0443\u0442\u0430\u043c\u0438 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f. \u0423\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043e \u043f\u043e 50 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"kotlin\">\/\/ \u0411\u044b\u043b\u043e: 50 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043f\u043e 1 \u0437\u0430\u0434\u0430\u0447\u0435\/\/ \u0421\u0442\u0430\u043b\u043e: 1 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 50 \u0437\u0430\u0434\u0430\u0447\u0430\u043c\u0438 \u0432\u043d\u0443\u0442\u0440\u0438val batchSize = 50clientIds.chunked(batchSize).forEach { batch -&gt;    process.addTask(MatchingDeltaExclusionsTask(batch))}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 <code>tq_task<\/code> \u0438 <code>tq_process<\/code> \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a.<\/p>\n<h4>3.6. \u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043a\u0430\u0440\u0442\u044b \u0438 \u0440\u0430\u043d\u043d\u0438\u0439 \u0432\u044b\u0445\u043e\u0434<\/h4>\n<h3>Roaring Bitmaps \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414<\/h3>\n<p>\u0420\u0430\u043d\u0435\u0435 \u043b\u0438\u0441\u0442\u043e\u0432\u044b\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u044b \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u0438 <code>(auditory_load_id, client_id)<\/code>, \u0430 INTERSECT\/SUBTRACT\/UNION \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438 JOIN \u043f\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430\u043c \u0441\u0442\u0440\u043e\u043a. \u041c\u044b \u043f\u0435\u0440\u0435\u0432\u0435\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u043d\u0430 roaring bitmaps:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c69\/331\/a2d\/c69331a2de0b2d2c70557fdf57cee68a.png\" width=\"1568\" height=\"1668\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/c69\/331\/a2d\/c69331a2de0b2d2c70557fdf57cee68a.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c69\/331\/a2d\/c69331a2de0b2d2c70557fdf57cee68a.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041b\u0438\u0441\u0442\u043e\u0432\u043e\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u043f\u0438\u0448\u0435\u0442 \u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438:<\/p>\n<pre><code class=\"sql\">CREATE TABLE tmp_auditory_bitmap (    auditory_load_id String,    bitmap AggregateFunction(groupBitmap, UInt64),    created_at DateTime DEFAULT now()) ENGINE = AggregatingMergeTree ORDER BY auditory_load_id  TTL created_at + INTERVAL 2 HOUR;INSERT INTO tmp_auditory_bitmapSELECT :fileId, groupBitmapState(toUInt64(client_id))FROM financial_clients WHERE ...;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>INTERSECT \u2014 <code>bitmapAnd<\/code> \u0432\u043c\u0435\u0441\u0442\u043e JOIN:<\/p>\n<pre><code class=\"sql\">-- \u0411\u044b\u043b\u043e: JOIN \u043f\u043e client_id, 38 \u0441\u0435\u043a\u0443\u043d\u0434-- \u0421\u0442\u0430\u043b\u043e: bitmapAnd, ~200 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434INSERT INTO tmp_auditory_bitmapSELECT :resultId, bitmapAnd(b1.bitmap, b2.bitmap)FROM tmp_auditory_bitmap b1 CROSS JOIN tmp_auditory_bitmap b2WHERE b1.auditory_load_id = :id1 AND b2.auditory_load_id = :id2;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>SUBTRACT \u2014 <code>bitmapAndnot<\/code>, UNION \u2014 <code>bitmapOr<\/code>. \u042d\u043a\u0441\u043f\u043e\u0440\u0442: <code>arrayJoin(bitmapToArray(client_bitmap))<\/code>.<\/p>\n<p>\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 64 \u0431\u0438\u0442\u0430 \u0437\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e. \u0414\u043b\u044f 10 \u043c\u043b\u043d \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u2014 ~156 000 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0421\u0436\u0430\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0430 10 \u043c\u043b\u043d \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u2014 5\u201315 \u041c\u0411. <code>client_id<\/code> \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d \u0432 <code>UInt64<\/code> \u0447\u0435\u0440\u0435\u0437 <code>cityHash64<\/code>; \u043a\u043e\u043b\u043b\u0438\u0437\u0438\u0438 \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u043d\u0438\u0436\u0435 0.0001%, \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u0434\u043e \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> <code>INTERSECT<\/code> 38 \u0441 \u2192 &lt; 1 \u0441; <code>SUBTRACT<\/code> 48 \u0441 \u2192 &lt; 1 \u0441; <code>UNION<\/code> 2 \u0441 \u2192 &lt; 100 \u043c\u0441.<\/p>\n<h3>Cardinality-aware DAG<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b: <code>A \u2229 \u2205 = \u2205<\/code>. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0434\u0432\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<p>Preflight <code>count()<\/code> \u043f\u0435\u0440\u0435\u0434 \u043f\u043e\u043b\u043d\u044b\u043c gather:<\/p>\n<pre><code class=\"kotlin\">val count = repository.estimateCount(params)if (count == 0L) {    task.result = AuditoryGatheringResult(isEmpty = true, rowCount = 0, ...)    return  \/\/ \u043f\u043e\u043b\u043d\u044b\u0439 gather \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>Short-circuit \u0432 INTERSECT \u0438 UNION:<\/p>\n<pre><code class=\"kotlin\">\/\/ INTERSECT:if (deps.any { it.isEmpty }) {    task.result = AuditoryGatheringResult(isEmpty = true)    return}\/\/ UNION:val nonEmpty = deps.filterNot { it.isEmpty }if (nonEmpty.size == 1) { task.result = nonEmpty.single(); return }<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u0448\u043b\u043e \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e: shadow mode (\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f), \u0437\u0430\u0442\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 feature flag.<\/p>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 (\u0440\u0435\u0434\u043a\u0438\u0435 MCC, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0433\u0435\u043e\u0433\u0440\u0430\u0444\u0438\u044f) \u2014 198 \u0441 \u2192 5\u201310 \u0441. \u041f\u043b\u043e\u0442\u043d\u044b\u0435 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u2014 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u043a\u0440\u043e\u043c\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0445 \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 <code>estimateCount<\/code>.<\/p>\n<h4>3.7. \u041a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/h4>\n<h3>Content-Addressable Segment Cache<\/h3>\n<p>\u041a\u0435\u0448 \u043f\u043e \u043a\u0430\u043d\u043e\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0445\u0435\u0448\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430\u0434\u0430\u0447\u0438:<\/p>\n<pre><code class=\"sql\">CREATE TABLE tq_segment_cache (    params_hash VARCHAR PRIMARY KEY,    file_id     VARCHAR NOT NULL,    table_name  VARCHAR NOT NULL DEFAULT 'tmp_auditory',    created_at  TIMESTAMPTZ NOT NULL DEFAULT NOW(),    expires_at  TIMESTAMPTZ NOT NULL);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<pre><code class=\"kotlin\">val hash = params.canonicalHash()  \/\/ SHA256 \u043e\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432val cached = segmentCacheRepository.findValid(hash)if (cached != null) {    task.result = AuditoryGatheringResult(fileId = cached.fileId, ...)    return  \/\/ 5 \u043c\u0441 \u0432\u043c\u0435\u0441\u0442\u043e 198 \u0441}val location = gatherAuditory(task)segmentCacheRepository.save(hash, location.fileId, ttl = 24.hours)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043b\u044e\u0447 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u044e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0442 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430:<\/p>\n<pre><code>cache_key = SHA256(task_type + canonical_params + source_data_version)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>\u041d\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0432 \u043a\u0435\u0448\u0430<\/h3>\n<p>\u041b\u0435\u043d\u0438\u0432\u044b\u0439 \u043a\u0435\u0448 \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u0440\u043e\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0432: \u0444\u043e\u043d\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432 02:00 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 50 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u043e\u0441\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 14 \u0434\u043d\u0435\u0439:<\/p>\n<pre><code class=\"kotlin\">@Recurring(id = \"PrecomputeSegmentsJob\", cron = \"0 2 * * *\")fun precomputePopularSegments() {    val popular = segmentCacheRepository.findMostUsed(limit = 50, since = 14.days)    popular.forEach { (hash, params) -&gt;        val fileId = repository.gatherAuditory(generateFileId(), params)        segmentCacheRepository.save(hash, fileId, ttl = 25.hours)    }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<pre><code class=\"yaml\">segment-precompute:  maxSegments: 50  maxDuration: 2h  maxParallelism: 2  ttl: 25h<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p><strong>\u042d\u0444\u0444\u0435\u043a\u0442:<\/strong> \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>FINANCIAL<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0437 \u043a\u0435\u0448\u0430 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u043e. \u041d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d\u0430 \u0441 \u043f\u0438\u043a\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u043d\u0430 \u043d\u043e\u0447\u044c.<\/p>\n<h4>3.8. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b<\/h4>\n<p>\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438\u0441\u044c \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u043e\u043c \u043a\u0430\u0436\u0434\u044b\u0435 15 \u0441\u0435\u043a\u0443\u043d\u0434 \u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0441 \u0440\u0443\u0447\u043d\u044b\u043c\u0438 \u0437\u0430 \u043e\u0434\u043d\u0438 \u0441\u043b\u043e\u0442\u044b. \u0412\u043d\u0435\u0434\u0440\u0435\u043d\u043e \u043f\u044f\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439:<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d11\/682\/177\/d11682177ec7e415fd2169249b9fa56e.png\" width=\"1568\" height=\"2188\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d11\/682\/177\/d11682177ec7e415fd2169249b9fa56e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d11\/682\/177\/d11682177ec7e415fd2169249b9fa56e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<ol>\n<li>\n<p><strong>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u044c <\/strong><code><strong>AUTO_GATHER<\/strong><\/code><strong> \u0441 2 \u0441\u043b\u043e\u0442\u0430\u043c\u0438.<\/strong> \u0424\u043e\u043d\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b \u043d\u0435 \u0432\u044b\u0442\u0435\u0441\u043d\u044f\u044e\u0442\u0441\u044f \u0440\u0443\u0447\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Deadline-aware \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442:<\/strong><\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">val urgency = when {    deadline &lt; now + 1.hours  -&gt; -20   \/\/ \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e    deadline &lt; now + 6.hours  -&gt; -10   \/\/ \u0441\u0440\u043e\u0447\u043d\u043e    deadline &lt; now + 24.hours -&gt; -5    \/\/ \u043f\u043b\u0430\u043d\u043e\u0432\u043e    else                      -&gt;  2    \/\/ \u0444\u043e\u043d\u043e\u0432\u043e}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<ol start=\"3\">\n<li>\n<p><strong>\u041d\u043e\u0447\u043d\u043e\u0435 \u043e\u043a\u043d\u043e.<\/strong> \u041f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b \u0441 deadline &gt; 24 \u0447 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 22:00\u201306:00. \u0414\u043d\u0435\u0432\u043d\u044b\u0435 \u0441\u043b\u043e\u0442\u044b \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0440\u0443\u0447\u043d\u044b\u043c \u0438 \u0441\u0440\u043e\u0447\u043d\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>Pre-gather.<\/strong> \u0417\u0430 6 \u0447\u0430\u0441\u043e\u0432 \u0434\u043e \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043e\u0444\u0444\u0435\u0440\u0430 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u0440\u0430\u043d\u0435\u0435:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">fun preGatherBeforeActivation() {    offerRepository.findActivatingWithin(6.hours)        .filter { !auditoryRepository.isFreshEnough(it.auditoryId, 12.hours) }        .forEach { offer -&gt;            gatheringService.run(AuditoryGatheringRequest(fromJob = true, deadline = offer.activateAt))        }}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<ol start=\"5\">\n<li>\n<p><strong>\u041f\u0440\u043e\u043f\u0443\u0441\u043a \u0434\u0435\u043b\u044c\u0442\u044b \u043f\u0440\u0438 \u043c\u0430\u043b\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438:<\/strong><\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"kotlin\">val deltaSize = estimateDelta(currentAuditory, newParams)if (deltaSize &lt; 0.01 * currentSize) return currentAuditory<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<h3>4. \u041a\u0430\u043a \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u0438 \u0438 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c<\/h3>\n<p>20 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u2014 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0451. \u041c\u044b \u0440\u0430\u0437\u0431\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u0448\u0435\u0441\u0442\u044c \u044d\u0442\u0430\u043f\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f: \u0434\u0435\u043f\u043b\u043e\u0439 \u2192 \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043c\u0435\u0440 \u0442\u0435\u043c \u0436\u0435 measurement-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u2192 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u043c baseline.<\/p>\n<h4>\u042d\u0442\u0430\u043f 1: \u0420\u0435\u0441\u0443\u0440\u0441\u044b<\/h4>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438:<\/strong> CPU limit 500m \u2192 2000m.<\/p>\n<p><strong>\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0432\u044b\u043c:<\/strong> \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 CPU limit \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u043c\u0430\u0442\u044c.<\/p>\n<p><strong>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430:<\/strong> throttled periods \u043d\u0430 Grafana \u0443\u043f\u0430\u043b\u0438 \u043d\u0430 85%. <code>avg_exec_sec<\/code> \u0441\u043d\u0438\u0437\u0438\u043b\u0441\u044f \u043d\u0430 20\u201330% \u043f\u043e \u0432\u0441\u0435\u043c \u0442\u0438\u043f\u0430\u043c \u0437\u0430\u0434\u0430\u0447. <code>avg_queue_sec<\/code> \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u2014 \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043c\u043e\u0449\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u043b\u0435\u0447\u0438\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u044c.<\/p>\n<h4>\u042d\u0442\u0430\u043f 2: \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/h4>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438:<\/strong> \u043f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 7 \u2192 15, <code>max-concurrent-tasks<\/code> 5 \u2192 10, \u043b\u0438\u043c\u0438\u0442 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414.<\/p>\n<p><strong>\u0420\u0438\u0441\u043a:<\/strong> \u043d\u0438\u0437\u043a\u0438\u0439. \u0423\u0434\u0432\u043e\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043c\u043e\u0433\u043b\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0431\u0430\u0437\u0443. \u041e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043b\u0438 connection errors \u0438 latency.<\/p>\n<p><strong>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430:<\/strong> <code>avg_queue_sec<\/code> \u0443\u043f\u0430\u043b \u0441 9 868 \u0434\u043e ~5 000 \u0441. \u041e\u0448\u0438\u0431\u043e\u043a \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u2014 \u043d\u043e\u043b\u044c.<\/p>\n<h4>\u042d\u0442\u0430\u043f 3: \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 + \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438:<\/strong> \u0447\u0435\u0442\u044b\u0440\u0435 \u0442\u0438\u043f\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439, fair scheduling SQL, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432 5 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432.<\/p>\n<p><strong>\u0420\u0438\u0441\u043a:<\/strong> \u0441\u0440\u0435\u0434\u043d\u0438\u0439. \u041e\u043a\u043e\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u2014 \u043d\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0443\u0442\u0438. \u041f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0441\u044f \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u043e <code>(status, node_id, process_id)<\/code> \u0438 <code>EXPLAIN ANALYZE<\/code> \u043d\u0430 \u043f\u0440\u043e\u0434-\u043e\u0431\u044a\u0451\u043c\u0435.<\/p>\n<p><strong>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430:<\/strong> <code>avg_queue_sec<\/code> \u0443\u043f\u0430\u043b \u0441 ~5 000 \u0434\u043e ~1 800 \u0441. P95 &gt; 20 000 \u0441 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f. \u041b\u0451\u0433\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u0447\u0430\u043b\u0438 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438.<\/p>\n<h4>\u042d\u0442\u0430\u043f 4: \u0420\u0430\u0441\u0447\u0438\u0441\u0442\u043a\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0434\u0432\u0438\u0436\u043a\u0430<\/h4>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438:<\/strong> \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u0441\u0442\u043e\u0440\u043e\u0436 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443, Shared Task \u0441 \u0434\u0435\u0434\u0443\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p><strong>\u0420\u0438\u0441\u043a:<\/strong> \u0441\u0440\u0435\u0434\u043d\u0438\u0439. Shared Task \u2014 \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u0432 \u044f\u0434\u0440\u0435 TQ.<\/p>\n<p><strong>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430:<\/strong> \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u0441\u043d\u0438\u0437\u0438\u043b\u0438\u0441\u044c. <code>getAvailableTasks<\/code> \u2014 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0441\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u044b\u0435 UPDATE \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442 \u0432\u044b\u0434\u0430\u0447\u0443. \u042d\u0444\u0444\u0435\u043a\u0442 ~10\u201315% \u043a <code>avg_total<\/code>.<\/p>\n<h4>\u042d\u0442\u0430\u043f 5: \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c + \u0431\u0430\u0442\u0447\u0438\u043d\u0433<\/h4>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438:<\/strong> \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 Kafka consumer, <code>FINANCIAL_MONTHLY_ALL<\/code>, \u0431\u0430\u0442\u0447\u0438\u043d\u0433 <code>MATCHING_DELTA_EXCLUSION<\/code>.<\/p>\n<p><strong>\u0420\u0438\u0441\u043a:<\/strong> \u0432\u044b\u0448\u0435 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445. Offset tracking \u043f\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u043c consume \u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0438 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p><strong>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430:<\/strong> EACH_MONTH \u2014 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c ~600 \u2192 ~210 \u0441. \u041f\u0430\u0447\u043a\u0430 \u0438\u0437 10 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 Kafka \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u0430 \u0432\u0440\u0435\u043c\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u043e\u043b\u0433\u043e\u0433\u043e. <code>tq_process<\/code> \u2014 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u0435\u043d\u044c\u0448\u0435 \u0441\u0442\u0440\u043e\u043a.<\/p>\n<h4>\u042d\u0442\u0430\u043f 6: \u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043a\u0430\u0440\u0442\u044b + \u043a\u0435\u0448 + \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b<\/h4>\n<p><strong>\u0427\u0442\u043e \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438:<\/strong> roaring bitmaps, cardinality-aware DAG, segment cache, \u043d\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0432, \u043f\u044f\u0442\u044c \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043e\u0432.<\/p>\n<p><strong>\u0420\u0438\u0441\u043a:<\/strong> \u0441\u0430\u043c\u044b\u0439 \u0432\u044b\u0441\u043e\u043a\u0438\u0439. \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414 \u0438 <code>cityHash64<\/code>. \u0421\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 fallback \u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u0434 feature flag.<\/p>\n<p><strong>\u0427\u0435\u0440\u0435\u0437 24 \u0447\u0430\u0441\u0430:<\/strong> <code>INTERSECT<\/code> 38 \u0441 \u2192 &lt; 1 \u0441, <code>SUBTRACT<\/code> 48 \u0441 \u2192 &lt; 1 \u0441, <code>UNION<\/code> 2 \u0441 \u2192 &lt; 100 \u043c\u0441. \u041f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f <code>FINANCIAL<\/code> \u2014 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0435 \u0432 \u043a\u0435\u0448. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u0443\u044e\u0442 \u0441 \u0440\u0443\u0447\u043d\u044b\u043c\u0438.<\/p>\n<h4>\u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0435 \u0446\u0438\u0444\u0440\u044b<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041c\u0435\u0442\u0440\u0438\u043a\u0430<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0411\u044b\u043b\u043e (\u043c\u0430\u0439 2026)<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0421\u0442\u0430\u043b\u043e (\u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u0430\u043f\u0430 6)<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">10 229 \u0441 (\u2248 2 \u0447 50 \u043c\u0438\u043d)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~10 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">361 \u0441 (\u2248 6 \u043c\u0438\u043d)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~8 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">9 868 \u0441 (\u2248 2 \u0447 44 \u043c\u0438\u043d)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~2 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">P95 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\">28 189 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~30 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 (\u043d\u043e\u0447\u043d\u043e\u0439 \u0445\u0432\u043e\u0441\u0442)<\/p>\n<\/td>\n<td>\n<p align=\"left\">32 851 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>~60 \u0441<\/strong><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3b4\/c3e\/6e8\/3b4c3e6e8af536ef68a20bf4f52c1867.png\" width=\"1274\" height=\"538\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/3b4\/c3e\/6e8\/3b4c3e6e8af536ef68a20bf4f52c1867.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3b4\/c3e\/6e8\/3b4c3e6e8af536ef68a20bf4f52c1867.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h4>\u041f\u043e \u0442\u0438\u043f\u0430\u043c \u0441\u0431\u043e\u0440\u043e\u0432<\/h4>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0422\u0438\u043f \u0441\u0431\u043e\u0440\u0430<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0411\u044b\u043b\u043e<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0421\u0442\u0430\u043b\u043e<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 MCC\/TERMINAL<\/p>\n<\/td>\n<td>\n<p align=\"left\">~200 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">~3 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">FINANCIAL WHOLE_PERIOD<\/p>\n<\/td>\n<td>\n<p align=\"left\">~600 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">~10 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">FINANCIAL EACH_MONTH 12 \u043c\u0435\u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">~800 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">~20 \u0441<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0430\u043c\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0431\u043e\u0440 + \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440<\/p>\n<\/td>\n<td>\n<p align=\"left\">10 000\u201330 000 \u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">~60 \u0441<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h4>\u0412\u043a\u043b\u0430\u0434 \u043f\u043e \u0441\u043b\u043e\u044f\u043c<\/h4>\n<p>\u0421\u043b\u043e\u0438 \u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u0443\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u0432\u043a\u043b\u0430\u0434 \u043d\u0435\u043b\u044c\u0437\u044f \u043c\u0435\u0445\u0430\u043d\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c. \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u043e\u0439 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0451\u043d \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u043c \u0437\u0430\u043c\u0435\u0440\u043e\u043c:<\/p>\n<ol>\n<li>\n<p><strong>\u0420\u0435\u0441\u0443\u0440\u0441\u044b + \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f:<\/strong> <code>queue_sec<\/code>: 9 868 \u2192 ~5 000 \u0441. ~\u00d72.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 + fair scheduling:<\/strong> <code>avg_total<\/code>: 10 229 \u2192 ~3 000 \u0441. ~\u00d71.7.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0441\u0447\u0438\u0441\u0442\u043a\u0430 \u0434\u0432\u0438\u0436\u043a\u0430:<\/strong> <code>avg_total<\/code> \u0435\u0449\u0451 \u221210\u201315%.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c + \u0431\u0430\u0442\u0447\u0438\u043d\u0433:<\/strong> \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432 ~600 \u2192 ~210 \u0441.<\/p>\n<\/li>\n<li>\n<p><strong>\u0411\u0438\u0442\u043e\u0432\u044b\u0435 \u043a\u0430\u0440\u0442\u044b + \u043a\u0435\u0448 + \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b:<\/strong> INTERSECT 38 \u2192 &lt; 1 \u0441, FINANCIAL \u2192 \u043a\u0435\u0448. <code>avg_exec<\/code>: 361 \u2192 ~8 \u0441.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e:<\/strong> \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u043e <strong>~\u00d745<\/strong> (361 \u2192 ~8 \u0441), \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0430 (9 868 \u2192 ~2 \u0441). \u041f\u043e\u043b\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u2014 \u0441 2 \u0447 50 \u043c\u0438\u043d \u0434\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<\/li>\n<\/ol>\n<h4>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043f\u0440\u043e \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0443<\/h4>\n<p>\u0424\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043d\u043e\u0433\u043e\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0432 CSV \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u043a\u0443\u043d\u0434. \u0412\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u0448\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u0435\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0430 \u0438\u0434\u0443\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n<h3>5. \u0427\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445<\/h3>\n<ol>\n<li>\n<p><strong>\u0418\u0437\u043c\u0435\u0440\u044f\u0439\u0442\u0435 queue\u2011vs\u2011exec \u0434\u043e\u00a0\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 SQL.<\/strong> 96.5% \u0432\u0440\u0435\u043c\u0435\u043d\u0438\u00a0\u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435. \u041f\u043e\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435\u00a0\u043f\u043e\u0447\u0438\u043d\u0435\u043d\u0430, \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432 \u0434\u0430\u0451\u0442 \u044d\u0444\u0444\u0435\u043a\u0442\u00a0\u043b\u0438\u0448\u044c \u043d\u0430 3.5% \u0431\u044e\u0434\u0436\u0435\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0439\u0442\u0435 \u043f\u0440\u0438\u0451\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435.<\/strong> \u041d\u0435\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u0437\u0430\u043b\u043f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0445\u0432\u043e\u0441\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442\u00a0\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447. \u041f\u043e\u0440\u0446\u0438\u0438, \u043e\u043a\u043d\u0430 \u0438 backpressure\u00a0\u2014 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u0437\u0430\u0449\u0438\u0442\u044b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0423\u0431\u0438\u0440\u0430\u0439\u0442\u0435 \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u00a0\u0433\u043e\u0440\u044f\u0447\u0435\u0433\u043e \u043f\u0443\u0442\u0438.<\/strong> <code>NOT EXISTS<\/code> \u043d\u0430\u00a0\u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0438\u043a\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u2192 \u044f\u0432\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 <code>READY<\/code> \u043f\u043e\u00a0\u0441\u043e\u0431\u044b\u0442\u0438\u044e. \u0421\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438\u00a0\u2014 \u0432\u00a0\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0446\u0438\u043a\u043b.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/strong> \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f\u043c\u0438\u00a0\u2014 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c. Roaring bitmaps: \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0441\u0435\u043a\u0443\u043d\u0434 \u2192 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u041f\u043b\u0430\u0442\u0430\u00a0\u2014 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0421\u0423\u0411\u0414.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435.<\/strong> Content\u2011addressable cache \u0438 \u043d\u043e\u0447\u043d\u043e\u0439 \u043f\u0440\u0435\u043a\u043e\u043c\u043f\u044c\u044e\u0442 \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u044e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0447\u0451\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439. \u041f\u043b\u0430\u0442\u0430\u00a0\u2014 \u0441\u0432\u0435\u0436\u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 TTL.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u043d\u0435\u0434\u0440\u044f\u0439\u0442\u0435 \u0441\u043b\u043e\u044f\u043c\u0438 \u0438 \u0438\u0437\u043c\u0435\u0440\u044f\u0439\u0442\u0435 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f.<\/strong> \u041d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u00abbig bang\u00bb. \u041a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u00a0\u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u0435\u043f\u043b\u043e\u0439, \u0441\u0443\u0442\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043c\u0435\u0440, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u00a0baseline. 20\u00a0\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439\u00a0\u2014 20\u00a0\u0437\u0430\u043c\u0435\u0440\u043e\u0432.<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<p>\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\/1045282\/\">https:\/\/habr.com\/ru\/articles\/1045282\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a \u043c\u0430\u044e 2026 \u0433\u043e\u0434\u0430 \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u043b 2 \u0447\u0430\u0441\u0430 50 \u043c\u0438\u043d\u0443\u0442. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0430 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0447\u0430\u0441\u0442\u0435\u0439. \u041f\u0435\u0440\u0432\u0430\u044f: 96.5% \u044d\u0442\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0442\u043e\u044f\u043b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0412\u0442\u043e\u0440\u0430\u044f: \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u043e\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0434\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f, \u0440\u0430\u0441\u0447\u0451\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u043b 6 \u043c\u0438\u043d\u0443\u0442 \u2014 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447 \u0432\u043d\u0443\u0442\u0440\u0438 DAG \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0432 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0441\u0442\u0440\u043e\u043a, \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0431\u044b\u043b\u0438 JOIN.\u041c\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043b\u0438 \u043e\u0431\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2014 20 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0440\u0430\u0437\u0431\u0438\u0442\u044b\u0445 \u043d\u0430 \u0448\u0435\u0441\u0442\u044c \u044d\u0442\u0430\u043f\u043e\u0432. \u041d\u0438\u0436\u0435 \u043e\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.\u0412\u0441\u0435 \u0447\u0438\u0441\u043b\u0430 \u00ab\u0434\u043e\u00bb \u0438 \u00ab\u043f\u043e\u0441\u043b\u0435\u00bb \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u043f\u043e Postgres \u2014 \u044d\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u0437\u0430\u043c\u0435\u0440.\u0414\u043e\u043c\u0435\u043d \u043e\u0431\u043e\u0431\u0449\u0451\u043d: \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u0431\u0443\u043b\u0435\u0432\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c (\u00ab\u0442\u0440\u0430\u0442\u044b &gt; 5000 \u20bd \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 3 \u043c\u0435\u0441\u044f\u0446\u0430\u00bb \u0418 \u00ab\u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0420\u0435\u0441\u0442\u043e\u0440\u0430\u043d\u044b\u00bb) \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0438\u0437 10-\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043d\u043e\u0439 \u0431\u0430\u0437\u044b \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.\u0413\u043b\u043e\u0441\u0441\u0430\u0440\u0438\u0439\u0422\u0435\u0440\u043c\u0438\u043d\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u0410\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044f (\u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438)\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0443 \u0443\u0441\u043b\u043e\u0432\u0438\u0439. \u00ab\u0421\u043e\u0431\u0440\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e\u00bb \u2014 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0440\u0443\u0436\u0443.DAG\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0433\u0440\u0430\u0444 \u0437\u0430\u0434\u0430\u0447: \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0436\u0434\u0451\u0442, \u043f\u043e\u043a\u0430 \u0434\u043e\u0441\u0447\u0438\u0442\u0430\u044e\u0442 \u0444\u0438\u043d\u0430\u043d\u0441\u044b \u0438 \u0433\u0435\u043e.TQ (\u0434\u0432\u0438\u0436\u043e\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u0447)\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u043f\u043e\u0432\u0435\u0440\u0445 Postgres: \u0445\u0440\u0430\u043d\u0438\u0442 \u0433\u0440\u0430\u0444, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0440\u0435\u0442\u0440\u0430\u0438 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.\u0412\u043e\u0440\u043a\u0435\u0440\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0437\u0430\u0434\u0430\u0447\u0438: FINANCIAL \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440, HASH \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0445\u0435\u0448\u0438, INTERSECT \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.\u041a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0430\u044f \u0421\u0423\u0411\u0414\u0410\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u0434\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432.\u041f\u0440\u043e\u0446\u0435\u0441\u0441 vs \u0437\u0430\u0434\u0430\u0447\u0430\u041e\u0434\u0438\u043d \u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u2014 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447 (\u0443\u0437\u043b\u043e\u0432 DAG).\u041e\u0447\u0435\u0440\u0435\u0434\u044c (queue) vs \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (exec)\u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0436\u0434\u0451\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0442\u0430 (queue), \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f (exec).\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c\u044b\u0435 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435:\u0412\u043e\u0440\u043a\u0435\u0440\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442FINANCIAL\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c: \u0441\u0443\u043c\u043c\u0430 \u0442\u0440\u0430\u0442, \u0434\u043e\u0445\u043e\u0434\u043e\u0432, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430 \u043f\u0435\u0440\u0438\u043e\u0434. \u0421\u0430\u043c\u044b\u0439 \u0442\u044f\u0436\u0451\u043b\u044b\u0439.HASH\u0421\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0444\u0430\u0439\u043b \u0445\u0435\u0448\u0435\u0439 (SHA512 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u0432, MD5 \u043f\u043e\u0447\u0442) \u0441 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0432 \u0431\u0430\u0437\u0435.MCC\u0424\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e \u043a\u043e\u0434\u0430\u043c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0442\u043e\u0440\u0433\u043e\u0432\u044b\u0445 \u0442\u043e\u0447\u0435\u043a (merchant category codes).INTERSECT\u041f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0442\u043e\u043a: \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0439\u0442\u0438 \u0432\u0441\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.UNION\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0439\u0442\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u043e\u0434\u0438\u043d \u0438\u0437 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432.SUBTRACT\u0412\u044b\u0447\u0438\u0442\u0430\u0435\u0442 \u043e\u0434\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0445 \u0432 \u0441\u0442\u043e\u043f-\u043b\u0438\u0441\u0442.DELTA_AUDITORY\u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0441\u0442\u0430\u0440\u043e\u0439 \u0438 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u0435.EXPORT\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 Kafka \/ S3.CLEAN_UP\u0423\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430.1. \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u0445: REST-\u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u0432\u0438\u0436\u043e\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0437\u0430\u0434\u0430\u0447 (TQ), \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0430\u044f \u0421\u0423\u0411\u0414 \u0438 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 (Kafka + S3).\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0441\u0431\u043e\u0440 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u043a\u0430\u043a DAG. \u041f\u043e\u0434 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0433\u0440\u0430\u0444 \u0437\u0430\u0434\u0430\u0447, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 Postgres \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u043c\u0438. DAG \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c (\u0444\u0438\u043d\u0430\u043d\u0441\u044b \u0438 \u0433\u0435\u043e \u0441\u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e), \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0436\u0434\u0451\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0432\u0435\u0442\u043e\u043a). \u042d\u0442\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043c\u044b \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 \u2014 \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0441\u0430\u043b\u0438\u0441\u044c \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432\u043e\u043a\u0440\u0443\u0433.\u0421\u043a\u0432\u043e\u0437\u043d\u043e\u0439 \u043f\u0443\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438\u0413\u0440\u0430\u0444 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f DSL:tqueue(type = &#171;AUDITORY_GATHERING&#187;, continuous = true, priority = 1) {    val fin  = task&lt;FinancialParams, SetResult&gt;(&#171;FINANCIAL&#187;)  { params { \/* \u043f\u0435\u0440\u0438\u043e\u0434, \u043f\u043e\u0440\u043e\u0433 *\/ } }    val mcc  = task&lt;MccParams, SetResult&gt;(&#171;MCC&#187;)              { params { \/* \u043a\u043e\u0434\u044b, \u043f\u0435\u0440\u0438\u043e\u0434 *\/ } }    val hash = task&lt;HashParams, SetResult&gt;(&#171;HASH&#187;)            { params { \/* \u0444\u0430\u0439\u043b \u0445\u0435\u0448\u0435\u0439 *\/ } }    val intersect = task&lt;IntersectParams, SetResult&gt;(&#171;INTERSECT&#187;) {        dependsOn(fin, mcc, hash)    }    val export = task&lt;ExportParams, Unit&gt;(&#171;EXPORT&#187;) { dependsOn(intersect) }    task&lt;CleanUpParams, Unit&gt;(&#171;CLEAN_UP&#187;) { dependsOn(export) }}\u0426\u0438\u043a\u043b \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u2014 \u0438\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f\u041a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u043b \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:\u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434:  1. \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438  2. \u0441\u0442\u043e\u0440\u043e\u0436: \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c TIMEOUT \u043f\u0440\u043e\u0441\u0440\u043e\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438  3. \u0441\u0442\u043e\u0440\u043e\u0436: \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c TIMEOUT \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0441\u0442\u0430\u0440\u044b\u0435 NEW  4. \u0441\u0442\u043e\u0440\u043e\u0436: \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u0435 \u0440\u0435\u0437\u0435\u0440\u0432\u0430\u0446\u0438\u0438  5. \u0440\u0430\u0437\u0434\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 + \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043d\u043e\u0434\u0443  6. \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0451\u043d\u043d\u044b\u0435 \u044d\u0442\u043e\u0439 \u043d\u043e\u0434\u0435 \u0437\u0430\u0434\u0430\u0447\u0438  7. \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c: IN_PROGRESS \u2192 \u0432\u043e\u0440\u043a\u0435\u0440 \u2192 \u0443\u0441\u043f\u0435\u0445\/\u043e\u0448\u0438\u0431\u043a\u0430\u041f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432 \u0448\u0430\u0433\u0430\u0445 1\u20134 \u2014 \u043e\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0434\u043e \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u0430 \u0434\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.\u0418\u0441\u0445\u043e\u0434\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u0420\u0435\u043f\u043b\u0438\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u04302CPU \/ \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0430 \u0440\u0435\u043f\u043b\u0438\u043a\u0443500m \/ 2 GiB (JVM -Xmx 1 GiB)\u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u04475\u041f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u04147\u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u043f\u0440\u043e\u0441\u0430 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u04305 \u0441\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0431\u043e\u0440\u043e\u0432\u043a\u0430\u0436\u0434\u044b\u0435 15 \u0441\u042d\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u044e\u0442 \u0431\u00f3\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u2014 \u043b\u0438\u043c\u0438\u0442 \u0432 5 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.2. \u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0447\u0438\u0441\u043b\u0430\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u043e \u2014 \u043d\u0438 Grafana-\u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0430, \u043d\u0438 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0439. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u0435\u0441\u044c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043b\u0441\u044f \u0432 Postgres: \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 tq_process \u0438 tq_task \u0435\u0441\u0442\u044c date_created (\u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c), date_started (\u0432\u0437\u044f\u0442\u0430 \u0432 \u0440\u0430\u0431\u043e\u0442\u0443) \u0438 date_finished (\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430). \u042d\u0442\u0438\u0445 \u0442\u0440\u0451\u0445 \u043c\u0435\u0442\u043e\u043a \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0435\u0439:SELECT    type AS process_type,    COUNT(*) AS total_runs,    ROUND(AVG(EXTRACT(EPOCH FROM (date_finished &#8212; date_created)))) AS avg_total_sec,    ROUND(PERCENTILE_CONT(0.95) WITHIN GROUP (        ORDER BY EXTRACT(EPOCH FROM (date_finished &#8212; date_created)))) AS p95_total_sec,    ROUND(AVG(EXTRACT(EPOCH FROM (date_finished &#8212; date_started)))) AS avg_exec_sec,    ROUND(AVG(EXTRACT(EPOCH FROM (date_started  &#8212; date_created)))) AS avg_queue_secFROM tq_processWHERE date_created &gt;= NOW() &#8212; INTERVAL &#8217;14 days&#8217;  AND status = &#8216;COMPLETED&#8217;GROUP BY type;2.1. 96.5% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435\u0422\u0438\u043f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u0417\u0430\u043f\u0443\u0441\u043a\u043e\u0432\u041f\u043e\u043b\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (avg)\u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (avg)\u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 (avg)AUDITORY_GATHERING3 76510 229 \u0441361 \u04419 868 \u0441MATCHING_DELTA_EXCLUSION16 8002 939 \u04411 \u04412 938 \u0441OFFER_AUDITORY_LOADING8 9558 \u04412 \u04416 \u0441\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0441\u0431\u043e\u0440 \u0448\u0451\u043b 2 \u0447\u0430\u0441\u0430 50 \u043c\u0438\u043d\u0443\u0442. \u0420\u0430\u0441\u0447\u0451\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u043b 6 \u043c\u0438\u043d\u0443\u0442. \u0412\u0441\u0451 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438. \u0412\u044b\u0432\u043e\u0434, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0432\u0448\u0438\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044e: \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f SQL \u0432 \u0432\u043e\u0440\u043a\u0435\u0440\u0430\u0445 \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 3.5% \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043d\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439, \u0430 \u0442\u043e, \u0447\u0442\u043e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u0442 \u0434\u043e \u043d\u0438\u0445.2.2. \u041e\u0434\u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430 \u0432\u0441\u0435\u0445\u041b\u0438\u043c\u0438\u0442 \u00ab5 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u00bb \u0431\u044b\u043b \u043e\u0431\u0449\u0438\u043c \u043d\u0430 \u0432\u0435\u0441\u044c \u043a\u043e\u043d\u0442\u0443\u0440. \u0420\u0430\u0437\u0431\u0440\u043e\u0441 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432:\u0422\u0438\u043f \u0437\u0430\u0434\u0430\u0447\u0438\u0418\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (avg)\u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 (avg)FINANCIAL198 \u0441272 \u0441DELTA_AUDITORY92 \u044112 708 \u0441SUBTRACT48 \u044112 606 \u0441INTERSECT38 \u044110 610 \u0441HASH13 \u044112 187 \u0441UNION2 \u044112 146 \u0441FINANCIAL (198 \u0441) \u0438 UNION (2 \u0441) \u043a\u043e\u043d\u043a\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0437\u0430 \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u043f\u044f\u0442\u044c \u0441\u043b\u043e\u0442\u043e\u0432. \u0412\u044b\u0434\u0430\u0447\u0430 \u0437\u0430\u0434\u0430\u0447 \u2014 ORDER BY priority, date_created \u2014 \u043e\u0437\u043d\u0430\u0447\u0430\u043b\u0430, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043c\u043e\u0433 \u0437\u0430\u043d\u044f\u0442\u044c \u0432\u0441\u0435 \u0441\u043b\u043e\u0442\u044b, \u043f\u043e\u043a\u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0436\u0434\u0430\u043b\u0438. \u041e\u0442\u0441\u044e\u0434\u0430 queue \u2248 27 \u00d7 exec.2.3. \u041d\u043e\u0447\u043d\u0430\u044f \u0432\u043e\u043b\u043d\u0430\u0412 22:00 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0430 \u043c\u0430\u0441\u0441\u0443 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043e\u0432 \u2014 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0421\u0430\u043c\u044b\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u043e\u043a\u043e\u043b\u043e 22:00:40 \u0438 \u0436\u0434\u0430\u043b\u0438 \u0434\u043e 32 000 \u0441\u0435\u043a\u0443\u043d\u0434 (\u2248 9 \u0447\u0430\u0441\u043e\u0432). \u041a \u0433\u0440\u0430\u0444\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0434\u0435\u043b\u044c\u0442\u0430-\u0437\u0430\u0434\u0430\u0447\u0438:\u0414\u0435\u043b\u044c\u0442\u0430-\u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u043b\u0430\u0441\u044c 92 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u0442\u0430 \u2014 12 708 \u0441\u0435\u043a\u0443\u043d\u0434. \u0421\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 138:1.2.4. \u0423\u0437\u043a\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u0434\u0432\u0438\u0436\u043a\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u0438\u041e\u043f\u0440\u043e\u0441 \u043c\u0435\u0436\u0434\u0443 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 DAG. delay(5s) \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0433\u0440\u0430\u0444\u0430 \u0436\u0434\u0430\u043b \u0434\u043e 5 \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445.\u0421\u0442\u043e\u0440\u043e\u0436\u0435\u0432\u044b\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u043f\u0443\u0442\u0438. \u0422\u0440\u0438 UPDATE-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c \u0434\u043e \u0440\u0430\u0437\u0434\u0430\u0447\u0438 \u0437\u0430\u0434\u0430\u0447. \u0417\u0430\u043c\u0435\u0434\u043b\u0435\u043d\u0438\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445 \u0437\u0430\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u043e \u0441\u0442\u0430\u0440\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.\u0420\u0435\u0437\u0435\u0440\u0432\u0430\u0446\u0438\u044f \u0432 \u0434\u0432\u0430 \u0448\u0430\u0433\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 node_id (\u0441\u0442\u0430\u0442\u0443\u0441 NEW), \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e IN_PROGRESS. \u041c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u2014 \u043e\u043a\u043d\u043e NEW + node_id, \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0435 \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0433\u043e\u043d\u043a\u0438.\u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0441\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e. continuous = true \u0432\u044b\u0437\u044b\u0432\u0430\u043b UPDATE tq_task SET priority = -1 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u0430. \u0414\u043b\u044f \u0433\u0440\u0430\u0444\u0430 \u0438\u0437 50 \u0437\u0430\u0434\u0430\u0447 \u2014 50 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 UPDATE.NOT EXISTS \u043f\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0446\u0438\u043a\u043b\u0435. \u0413\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u043b\u0430\u0441\u044c \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0441\u043e \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0442\u044b\u0441\u044f\u0447 \u0441\u0442\u0440\u043e\u043a tq_task_dependencies \u043a\u0430\u0436\u0434\u044b\u0435 5 \u0441\u0435\u043a\u0443\u043d\u0434.2.5. \u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u043b\u043a\u0430\u044f \u043d\u0430\u0440\u0435\u0437\u043a\u0430 DAG\u0424\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u0430\u044f \u0432\u0435\u0442\u043a\u0430 \u0434\u0440\u043e\u0431\u0438\u043b\u0430\u0441\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043c\u0435\u0441\u044f\u0446\u0443 (\u0440\u0435\u0436\u0438\u043c EACH_MONTH), MCC \u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0437\u0440\u0435\u0437\u0430\u043b\u0438\u0441\u044c \u043f\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0430\u043c. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f:\u0414\u043b\u044f 12 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u044d\u0442\u043e \u0434\u0430\u0432\u0430\u043b\u043e 16 TQ-\u0437\u0430\u0434\u0430\u0447 \u0438 3 \u0443\u0440\u043e\u0432\u043d\u044f DAG \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u0443\u044e \u0432\u0435\u0442\u043a\u0443. \u041a\u0430\u0436\u0434\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u2014 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438.2.6. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0441\u0447\u0451\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445\u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0441\u0442\u0440\u043e\u0438\u043b\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 DAG \u0441 \u043d\u0443\u043b\u044f. \u0421\u043e\u0442\u043d\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0441 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c\u0438 FINANCIAL(\u044f\u043d\u0432\u0430\u0440\u044c, \u043f\u043e\u0440\u043e\u0433 5000) \u2014 \u044d\u0442\u043e \u0441\u043e\u0442\u043d\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u0443\u044e \u0421\u0423\u0411\u0414.3. \u0420\u0435\u0448\u0435\u043d\u0438\u044f\u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 20 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0441\u043b\u043e\u044f\u043c. \u041d\u0438\u0436\u0435 \u2014 \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u2014 \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u0438 \u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043b\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b.3.1. \u0420\u0435\u0441\u0443\u0440\u0441\u044b \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044fCPU throttling \u2192 2000mGrafana \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u0430 54 000+ throttled periods: JVM \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043f\u0440\u0438\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0430\u0441\u044c Kubernetes CFS-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 JDBI, \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0438 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u043d\u0430 70\u201380% \u043e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438.# k8s values \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435:resources:  limits:    cpu: 2000m    # \u0431\u044b\u043b\u043e 500m  requests:    cpu: 500m     # \u043d\u0435 \u043c\u0435\u043d\u044f\u043b\u0438 \u2014 \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 scheduling\u042d\u0444\u0444\u0435\u043a\u0442: \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u043a\u043e\u0440\u0438\u043b\u043e\u0441\u044c \u043d\u0430 20\u201330%. \u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 CPU limit \u043d\u0435 \u043d\u0435\u0441\u0451\u0442 \u0440\u0438\u0441\u043a\u0430.\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043f\u0443\u043b\u0430 \u0438 \u043b\u0438\u043c\u0438\u0442\u043e\u0432\u041f\u0443\u043b \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u043a \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414: 7 \u2192 15. max-concurrent-tasks: 5 \u2192 10. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u044f\u0432\u043d\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 \u043d\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043e\u043b\u043e\u043d\u043e\u0447\u043d\u043e\u0439 \u0421\u0423\u0411\u0414 \u2014 \u0440\u0430\u043d\u0435\u0435 \u043e\u043d \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b.database.clickhouse.datasource:  maximumPoolSize: 15    # \u0431\u044b\u043b\u043e 7tqueue:  max-concurrent-tasks: 10   # \u0431\u044b\u043b\u043e 5  queue-limits:    KAFKA: 2    CLICKHOUSE: 2    COLUMNAR_DB: 8           # \u043d\u043e\u0432\u044b\u0439 \u043b\u0438\u043c\u0438\u0442\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439 \u043f\u043e \u0442\u0438\u043f\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438FINANCIAL (198 \u0441) \u0438 UNION (2 \u0441) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u0442\u043e\u044f\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438:tqueue:  queue-limits:    HEAVY: 3       # FINANCIAL, AGGREGATION \u2014 \u0442\u044f\u0436\u0451\u043b\u0430\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430    LIGHT: 10      # INTERSECT, UNION, HASH, MCC \u2014 \u043b\u0451\u0433\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438    FILE_OP: 5     # EXPORT, CLEAN_UP \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438    AUTO_GATHER: 2 # \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u044b\/\/ FINANCIAL, FINANCIAL_AGGREGATION \u2192 HEAVYtask.queueType = &#171;HEAVY&#187;\/\/ INTERSECT, UNION, HASH, MCC \u2192 LIGHTtask.queueType = &#171;LIGHT&#187;\/\/ EXPORT, CLEAN_UP \u2192 FILE_OPtask.queueType = &#171;FILE_OP&#187;\u042d\u0444\u0444\u0435\u043a\u0442: UNION \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0436\u0434\u0430\u0442\u044c \u0437\u0430 FINANCIAL. \u041a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0443\u0442\u044c DAG \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u043d\u0430 15\u201320%.3.2. \u0421\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435Fair scheduling: ROW_NUMBER \u043f\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0421\u0442\u0430\u0440\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 ORDER BY priority, date_created LIMIT 5 \u043e\u0442\u0434\u0430\u0432\u0430\u043b \u0432\u0441\u0435 \u0441\u043b\u043e\u0442\u044b \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0443. \u041d\u043e\u0432\u044b\u0439&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-482914","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/482914","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=482914"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/482914\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=482914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=482914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=482914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}