{"id":319461,"date":"2021-03-12T15:00:32","date_gmt":"2021-03-12T15:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=319461"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=319461","title":{"rendered":"\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 93% (Redis)"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0446\u0435\u043b\u044c\u044e \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p>\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0411\u0414 Redis.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c RAM \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>Redis \u044d\u0442\u043e no-sql \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <em>redis-cli &#8212;bigkeys<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043a\u043e\u043b-\u0432\u043e \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u044e\u0447. <\/p>\n<p>\u041e\u0431\u044a\u0435\u043c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u043e <em>sorted sets<\/em>. \u0423 \u043d\u0438\u0445 \u0431\u044b\u043b\u0430 \u0440\u043e\u0442\u0430\u0446\u0438\u044f 10 \u0434\u043d\u0435\u0439 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0446\u0435\u043d\u044b \/ \u0434\u0430\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0443 \u043e\u0444\u0444\u0435\u0440\u0430. \u041e\u0444\u0444\u0435\u0440\u043e\u0432 \u0431\u044b\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u2013 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 15000 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0438\u0434\u0435 (\u043f\u0440\u0430\u0439\u0441\u043b\u0438\u0441\u0442\u0435).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e \u043e\u0444\u0444\u0435\u0440\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/051\/6b3\/04b\/0516b304b6f9461100230c2404b0c661.png\" alt=\"\u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e http:\/\/json.parser.online.fr\/\" title=\"\u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e http:\/\/json.parser.online.fr\/\" width=\"1268\" height=\"846\"><figcaption>\u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e http:\/\/json.parser.online.fr\/<\/figcaption><\/figure>\n<p><code>{\"EventName\":\"DELIVERY_CHANGED\",\"DateTime\":\"2021-02-22T00:04:00.112593982+03:00\",\"OfferId\":\"109703\",\"OfferFrom\":{\"Id\":\"109703\",\"Name\":\"\u0421\u0430\u0443\u043d\u0434\u0431\u0430\u0440 LG SN11R\",\"Url\":\"https:\/\/www.example.ru\/saundbar-lg-sn11r\/?utm_source=yandex_market&amp;utm_medium=cpc&amp;utm_content=948&amp;utm_campaign=3&amp;utm_term=109703\",\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-24T23:49:00+03:00\"},\"OfferTo\":{\"Id\":\"109703\",\"Name\":\"\u0421\u0430\u0443\u043d\u0434\u0431\u0430\u0440 LG SN11R\",\"Url\":\"https:\/\/www.example.ru\/saundbar-lg-sn11r\/?utm_source=yandex_market&amp;utm_medium=cpc&amp;utm_content=948&amp;utm_campaign=3&amp;utm_term=109703\",\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-23T00:04:00.112593982+03:00\"}}<\/code><\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442  706 \u0431\u0430\u0439\u0442.<\/p>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<ol>\n<li>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b \u0440\u043e\u0442\u0430\u0446\u0438\u044e \u0434\u043e 7 \u0434\u043d\u0435\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043d\u0435\u0434\u0435\u043b\u044f. \u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0448\u0430\u0433 \u0432\u0435\u0441\u044c\u043c\u0430 \u043b\u0435\u0433\u043a\u0438\u0439(\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b 10 \u043d\u0430 7), \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 RAM \u043d\u0430 30%.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u043b \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <em>name<\/em>, <em>url<\/em>, <em>offerId<\/em> \u0447\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e \u0435\u0449\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 50%.<\/p>\n<p>C\u0442\u0430\u043b\u043e:<\/p>\n<p><code>{\"EventName\":\"DELIVERY_CHANGED\",\"DateTime\":\"2021-02-22T00:04:00.112593982+03:00\",\"OfferId\":\"109703\",\"OfferFrom\":{\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-24T23:49:00+03:00\"},\"OfferTo\":{\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-23T00:04:00.112593982+03:00\"}}<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 334 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043b \u0444\u043e\u0440\u043c\u0430\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441 json \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 protobuf.<\/p>\n<p>\u041e\u0431 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u0445\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0441\u043b\u0443\u0447\u0435\u0435 \u0441 protobuf&nbsp; \u044d\u0442\u043e proto &#8212; \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"go\">syntax = \"proto3\";  import \"google\/protobuf\/timestamp.proto\";  message OfferEvent {   enum EventType {     PRICE_CHANGED = 0;     DELIVERY_CHANGED = 1;     DELIVERY_SWITCHED = 2;     APPEARED = 3;     DISAPPEARED = 4;   }   EventType event_name = 1;   google.protobuf.Timestamp date_time = 2;    string offer_id = 3;    message Offer {     int32 price = 1;     bool delivery_available = 2;     int32 delivery_cost = 3;     google.protobuf.Timestamp  delivery_date = 4;   }    Offer offer_from = 4;   Offer offer_to = 5; } <\/code><\/pre>\n<\/li>\n<li>\n<p> \u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c protobuf \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a<\/p>\n<pre><code class=\"go\">event_name: DELIVERY_CHANGED date_time {   seconds: 1613941440 } offer_id: \"109703\" offer_from {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614199740   } } offer_to {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614027840   } } <\/code><\/pre>\n<\/li>\n<li>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c protobuf \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a<\/p>\n<pre><code class=\"bash\">echo ' event_name: DELIVERY_CHANGED date_time {   seconds: 1613941440 } offer_id: \"109703\" offer_from {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614199740   } } offer_to {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614027840   } } ' | protoc --encode=OfferEvent offerevent.proto | xxd -p | tr -d \"\\n\" 0801120608c095cb81061a06313039373033220e08968d061001220608bcf7da81062a0e08968d061001220608c0b8d08106<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 50 \u0431\u0430\u0439\u0442. \u042d\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 85%.<\/p>\n<p>\u0411\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 proto-\u0441\u0445\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043d\u043b\u0430\u0439\u043d-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 https:\/\/protogen.marcgravell.com\/<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2>\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0441\u0442\u0430 \u0431\u043e\u043b\u0435\u0435, \u0447\u0435\u043c \u0432 14 \u0440\u0430\u0437 (50 \u0431\u0430\u0439\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 706 \u0431\u0430\u0439\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445), \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 93%.<\/p>\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\/post\/546734\/\"> https:\/\/habr.com\/ru\/post\/546734\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043e\u043f\u044b\u0442\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0446\u0435\u043b\u044c\u044e \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0441\u0445\u043e\u0434\u043e\u0432 \u043d\u0430 \u0440\u0435\u0441\u0443\u0440\u0441\u044b.<\/p>\n<p>\u0412 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u043d\u043e \u0438\u043b\u0438 \u043f\u043e\u0437\u0434\u043d\u043e \u0432\u0441\u0442\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0431 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0411\u0414 Redis.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c RAM \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0438\u0433\u0440\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>Redis \u044d\u0442\u043e no-sql \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b <em>redis-cli &#8212;bigkeys<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u043a\u043e\u043b-\u0432\u043e \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043b\u044e\u0447. <\/p>\n<p>\u041e\u0431\u044a\u0435\u043c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u043e <em>sorted sets<\/em>. \u0423 \u043d\u0438\u0445 \u0431\u044b\u043b\u0430 \u0440\u043e\u0442\u0430\u0446\u0438\u044f 10 \u0434\u043d\u0435\u0439 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0446\u0435\u043d\u044b \/ \u0434\u0430\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u0443 \u043e\u0444\u0444\u0435\u0440\u0430. \u041e\u0444\u0444\u0435\u0440\u043e\u0432 \u0431\u044b\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u2013 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 15000 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0438\u0434\u0435 (\u043f\u0440\u0430\u0439\u0441\u043b\u0438\u0441\u0442\u0435).<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e \u043e\u0444\u0444\u0435\u0440\u0443:<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0434\u0435\u043b\u0430\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e http:\/\/json.parser.online.fr\/<\/figcaption><\/figure>\n<p><code>{\"EventName\":\"DELIVERY_CHANGED\",\"DateTime\":\"2021-02-22T00:04:00.112593982+03:00\",\"OfferId\":\"109703\",\"OfferFrom\":{\"Id\":\"109703\",\"Name\":\"\u0421\u0430\u0443\u043d\u0434\u0431\u0430\u0440 LG SN11R\",\"Url\":\"https:\/\/www.example.ru\/saundbar-lg-sn11r\/?utm_source=yandex_market&amp;utm_medium=cpc&amp;utm_content=948&amp;utm_campaign=3&amp;utm_term=109703\",\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-24T23:49:00+03:00\"},\"OfferTo\":{\"Id\":\"109703\",\"Name\":\"\u0421\u0430\u0443\u043d\u0434\u0431\u0430\u0440 LG SN11R\",\"Url\":\"https:\/\/www.example.ru\/saundbar-lg-sn11r\/?utm_source=yandex_market&amp;utm_medium=cpc&amp;utm_content=948&amp;utm_campaign=3&amp;utm_term=109703\",\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-23T00:04:00.112593982+03:00\"}}<\/code><\/p>\n<p>\u0422\u0430\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442  706 \u0431\u0430\u0439\u0442.<\/p>\n<h2>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<ol>\n<li>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u043b \u0440\u043e\u0442\u0430\u0446\u0438\u044e \u0434\u043e 7 \u0434\u043d\u0435\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043d\u0435\u0434\u0435\u043b\u044f. \u0417\u0434\u0435\u0441\u044c \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0448\u0430\u0433 \u0432\u0435\u0441\u044c\u043c\u0430 \u043b\u0435\u0433\u043a\u0438\u0439(\u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b 10 \u043d\u0430 7), \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 RAM \u043d\u0430 30%.<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0438\u043b \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438\u0441\u044c, \u043d\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <em>name<\/em>, <em>url<\/em>, <em>offerId<\/em> \u0447\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e \u0435\u0449\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 50%.<\/p>\n<p>C\u0442\u0430\u043b\u043e:<\/p>\n<p><code>{\"EventName\":\"DELIVERY_CHANGED\",\"DateTime\":\"2021-02-22T00:04:00.112593982+03:00\",\"OfferId\":\"109703\",\"OfferFrom\":{\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-24T23:49:00+03:00\"},\"OfferTo\":{\"Price\":99990,\"DeliveryAvailable\":true,\"DeliveryCost\":0,\"DeliveryDate\":\"2021-02-23T00:04:00.112593982+03:00\"}}<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 334 \u0431\u0430\u0439\u0442\u0430.<\/p>\n<ol>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u043b \u0444\u043e\u0440\u043c\u0430\u0442 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441 json \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 protobuf.<\/p>\n<p>\u041e\u0431 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0441\u0445\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u0441\u043b\u0443\u0447\u0435\u0435 \u0441 protobuf&nbsp; \u044d\u0442\u043e proto &#8212; \u0444\u0430\u0439\u043b:<\/p>\n<pre><code class=\"go\">syntax = \"proto3\";  import \"google\/protobuf\/timestamp.proto\";  message OfferEvent {   enum EventType {     PRICE_CHANGED = 0;     DELIVERY_CHANGED = 1;     DELIVERY_SWITCHED = 2;     APPEARED = 3;     DISAPPEARED = 4;   }   EventType event_name = 1;   google.protobuf.Timestamp date_time = 2;    string offer_id = 3;    message Offer {     int32 price = 1;     bool delivery_available = 2;     int32 delivery_cost = 3;     google.protobuf.Timestamp  delivery_date = 4;   }    Offer offer_from = 4;   Offer offer_to = 5; } <\/code><\/pre>\n<\/li>\n<li>\n<p> \u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c protobuf \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a<\/p>\n<pre><code class=\"go\">event_name: DELIVERY_CHANGED date_time {   seconds: 1613941440 } offer_id: \"109703\" offer_from {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614199740   } } offer_to {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614027840   } } <\/code><\/pre>\n<\/li>\n<li>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0438\u0442\u043e\u0433\u043e\u0432\u043e\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u043c protobuf \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a<\/p>\n<pre><code class=\"bash\">echo ' event_name: DELIVERY_CHANGED date_time {   seconds: 1613941440 } offer_id: \"109703\" offer_from {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614199740   } } offer_to {   price: 99990   delivery_available: true   delivery_date {     seconds: 1614027840   } } ' | protoc --encode=OfferEvent offerevent.proto | xxd -p | tr -d \"\\n\" 0801120608c095cb81061a06313039373033220e08968d061001220608bcf7da81062a0e08968d061001220608c0b8d08106<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 50 \u0431\u0430\u0439\u0442. \u042d\u0442\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 85%.<\/p>\n<p>\u0411\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0435\u0437 proto-\u0441\u0445\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043d\u043b\u0430\u0439\u043d-\u0441\u0435\u0440\u0432\u0438\u0441\u0430 https:\/\/protogen.marcgravell.com\/<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2>\u0418\u0442\u043e\u0433\u043e<\/h2>\n<p>\u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0435\u0441\u0442\u0430 \u0431\u043e\u043b\u0435\u0435, \u0447\u0435\u043c \u0432 14 \u0440\u0430\u0437 (50 \u0431\u0430\u0439\u0442 \u043f\u0440\u043e\u0442\u0438\u0432 706 \u0431\u0430\u0439\u0442 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0445), \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0430 93%.<\/p>\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\/post\/546734\/\"> https:\/\/habr.com\/ru\/post\/546734\/<\/a><br \/><\/br><\/br><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-319461","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319461","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=319461"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/319461\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=319461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=319461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=319461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}