{"id":18001,"date":"2024-01-30T11:24:39","date_gmt":"2024-01-30T04:24:39","guid":{"rendered":"https:\/\/gcloudvn.com\/?p=18001"},"modified":"2024-01-30T11:24:39","modified_gmt":"2024-01-30T04:24:39","slug":"cloud-pub-sub-la-gi","status":"publish","type":"post","link":"https:\/\/gcloudvn.com\/en\/kienthuc\/cloud-pub-sub-la-gi\/","title":{"rendered":"What is Cloud Pub\/Sub? Compare Cloud Pub\/sub and Kafka"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In order for the business operation process to be smooth and uninterrupted, application software will regularly send information (messages) to each other, however, during the process of sharing information, there may be situations where it is not received. receive full information from the sender, to resolve this issue <\/span><b>Cloud Pub\/Sub<\/b><span style=\"font-weight: 400;\"> was born, so what is Cloud pub\/sub? Let&#039;s find out details through the article below.\u00a0\u00a0<\/span><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cloud-pub-sub-la-gi\/#Cloud_pubsub_la_gi\" >What is cloud pub\/sub?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cloud-pub-sub-la-gi\/#Cloud_PubSub_hoat_dong_nhu_the_nao\" >How Cloud Pub\/Sub works<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cloud-pub-sub-la-gi\/#Cloud_PubSub_ung_dung_nhu_the_nao\" >How does Cloud Pub\/Sub apply?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/cloud-pub-sub-la-gi\/#Cai_dat_Cloud_pubsub_nhu_the_nao\" >How to install Cloud pub\/sub<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Cloud_pubsub_la_gi\"><\/span><strong>What is cloud pub\/sub?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><b>Cloud Pub\/Sub<\/b><span style=\"font-weight: 400;\"> is an asynchronous and scalable Messaging service. Pub\/Sub can be imagined as a transfer station between the sender of information called <\/span><b>Publisher <\/b><span style=\"font-weight: 400;\">and the receiving party <\/span><b>Subscriber.<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Pub\/Sub allows you to create a system of exchange events between publishers and subscribers. The Publisher will communicate asynchronously with the Subscriber by sending events with a latency of about 100 million seconds instead of synchronous remote procedure calls (RPC).<\/span><\/p>\n<p><b>Publisher <\/b><span style=\"font-weight: 400;\">send events to the Pub\/Sub service portal without regard to how and when these events will be handled. Pub\/Sub will then distribute the events to all services that need to receive the information. Asynchronous integration in Pub\/Sub increases the flexibility and robustness of the entire system.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cloud_PubSub_hoat_dong_nhu_the_nao\"><\/span><strong>How Cloud Pub\/Sub works<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Some important concepts in Cloud Pub\/Sub<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Publisher<\/b><span style=\"font-weight: 400;\">: create messages and send (publish) them to Messaging service according to a specific topic.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Message<\/b><span style=\"font-weight: 400;\">: data moving through the service.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Topic<\/b><span style=\"font-weight: 400;\">: entity representing a message feed.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Schema<\/b><span style=\"font-weight: 400;\">: entity that governs the data format of Pub\/Sub messages.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Subscription<\/b><span style=\"font-weight: 400;\">: entity expressing interest in receiving messages about a specific topic.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Subscriber<\/b> <span style=\"font-weight: 400;\">: receive messages on a specified subscriber.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">The model illustrates how cloud Pub\/Sub works as follows:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Two <\/span><b>Publisher<\/b><span style=\"font-weight: 400;\"> send two different messages to a common Pub\/Sub topic.<\/span><b><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18005\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-1.jpg\" alt=\"\" width=\"601\" height=\"316\" srcset=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-1.jpg 601w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-1-18x9.jpg 18w\" sizes=\"auto, (max-width: 601px) 100vw, 601px\" \/><\/b><\/li>\n<\/ul>\n<ul>\n<li><b>Lifecycle of a message in Pub\/Sub<\/b><span style=\"font-weight: 400;\">: Suppose a publisher client is connected to a specific topic. Topic has an attached subscription and a subscriber connected to the subscription.<\/span><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18004\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-2.jpg\" alt=\"\" width=\"600\" height=\"405\" srcset=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-2.jpg 600w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-2-18x12.jpg 18w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<ul>\n<li aria-level=\"1\"><b>Select the Publish template and Subscribe Pub\/Sub<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">When there are multiple Publisher and Subscriber customers, it is necessary to choose the type of Publish and Subscribe architecture you want to set up.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18003\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-3.jpg\" alt=\"\" width=\"600\" height=\"353\" srcset=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-3.jpg 600w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-3-18x12.jpg 18w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Cloud_PubSub_ung_dung_nhu_the_nao\"><\/span><strong>How does Cloud Pub\/Sub apply?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Collect user and server interaction events<\/b><span style=\"font-weight: 400;\">: To use user interaction events collected from your application, you can forward them to the Pub\/Sub service, which in turn uses a <\/span><b>stream processing<\/b><span style=\"font-weight: 400;\"> such as <\/span><b>.<\/b><span style=\"font-weight: 400;\">, this tool will support transferring collected events to the database, Pub\/Sub allows you to collect events from multiple customers at the same time. Examples of databases include BigQuery, Cloud Bigtable, and Cloud Storage.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Real-time event distribution<\/b><span style=\"font-weight: 400;\">: Events can be distributed to multiple applications within the organization for real-time processing.\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Copy data between databases<\/b><span style=\"font-weight: 400;\">. Pub\/Sub is commonly used to distribute change events from the database. Administrators can use these events to build historical and database status views in BigQuery and other data storage systems.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Parallel processing and workflows<\/b><span style=\"font-weight: 400;\">. You can efficiently distribute multiple tasks among multiple workers by using Pub\/Sub notifications to connect to Cloud Functions. Examples of such tasks are compressing text files, sending email notifications, evaluating models, and reformatting images.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Transmit data from applications, services, or IoT devices<\/b><span style=\"font-weight: 400;\">. For example, sensors can stream data to Pub\/Sub for use in other Google Cloud products via a Dataflow pipeline.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Refresh distributed caches<\/b><span style=\"font-weight: 400;\">i. For example, an application can publish invalidation events to update the IDs of objects that have changed.<\/span><\/li>\n<\/ul>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>Ensure load balancing (Lead balancing).<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Cai_dat_Cloud_pubsub_nhu_the_nao\"><\/span><strong>How to install Cloud pub\/sub<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><b>B1<\/b><span style=\"font-weight: 400;\">. Create or select a Google Cloud project where you can set up Pub\/Sub.<\/span><\/p>\n<p><b>B2<\/b><span style=\"font-weight: 400;\">. Enable Pub\/Sub API.<\/span><\/p>\n<p><b>B3<\/b><span style=\"font-weight: 400;\">. Get the roles and permissions needed to run Pub\/Sub.<\/span><\/p>\n<p><b>B4<\/b><span style=\"font-weight: 400;\">. Create a topic (Topic)<\/span><\/p>\n<p><b>B5<\/b><span style=\"font-weight: 400;\">. Determine the schema for your messages.<\/span><\/p>\n<p><b>B6<\/b><span style=\"font-weight: 400;\">. Attach schema to topic.<\/span><\/p>\n<p><b>B7<\/b><span style=\"font-weight: 400;\">. Configure the publisher client to be able to publish messages to the topic.<\/span><\/p>\n<p><b>B8<\/b><span style=\"font-weight: 400;\">. If required, configure advanced publishing options such as flow control, bulk messaging, and concurrency control.<\/span><\/p>\n<p><b>B9<\/b><span style=\"font-weight: 400;\">. Choose your subscription type based on how you want to receive your messages.<\/span><\/p>\n<p><b>B10<\/b><span style=\"font-weight: 400;\">. Create a subscription for the selected topic.<\/span><\/p>\n<p><b>B11<\/b><span style=\"font-weight: 400;\">. Configure the subscriber client to be able to receive messages from the subscription.<\/span><\/p>\n<p><b>B12<\/b><span style=\"font-weight: 400;\">. If required, configure advanced messaging options such as exactly once delivery, lease management, on-demand delivery, and flow control.<\/span><\/p>\n<p><b>B13<\/b><span style=\"font-weight: 400;\">. Start publishing messages from the publisher client to the topic.<\/span><\/p>\n<p><b>B14<\/b><span style=\"font-weight: 400;\">. At the same time, set up a subscription client to receive and process these messages.<\/span><\/p>\n<p><strong><span style=\"color: #202124; font-size: 1.615em;\">Compare cloud pub\/sub vs kafka<\/span><\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-18002\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-4.jpg\" alt=\"\" width=\"600\" height=\"258\" srcset=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-4.jpg 600w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2024\/01\/cloud-pub-sub-4-18x8.jpg 18w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>Kafka:\u00a0<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kafka is an open-source platform for building real-time streaming and data pipeline applications, designed to handle large data streams with the ability to handle and handle large data streams. Error handling with low latency. Kafka is widely used in industries such as finance, e-commerce, and social media<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kafka provides official client libraries for Java, Python, and Go. Kafka is highly scalable but requires manual intervention.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Kafka is open source with no licensing fees but requires significant infrastructure installation and maintenance.<\/span><\/li>\n<\/ul>\n<p><b>Cloud Pub\/Sub:\u00a0<\/b><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">GCP Pub\/Sub is a fully managed messaging service powered by Google Cloud Platform that enables message exchange between applications with persistent message archiving, real-time delivery, and auto-opening wide scale. Cloud Pub\/Sub has the ability to integrate with other GCP services such as Dataflow, Cloud Functions, and BigQuery.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Pub\/Sub has client libraries for Java, Python, Node.js, and C#. Cloud Pub\/Sub has the ability to scale automatically without manual intervention.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Pub\/Sub is a paid service with costs that will vary based on actual usage.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Above is a summary of all information about <\/span><b>Cloud Pub\/Sub<\/b><span style=\"font-weight: 400;\"> \u2013 messaging service from Google. With powerful fast processing advantages to ensure the process of sending information between business applications combined with extensive integration capabilities with other Google Cloud solutions, Cloud Pub\/Sub is the optimal choice for businesses. during the transition to using Google Cloud solutions.\u00a0<\/span><\/p>","protected":false},"excerpt":{"rendered":"<p>\u0110\u1ec3 qu\u00e1 tr\u00ecnh v\u1eadn h\u00e0nh doanh nghi\u1ec7p lu\u00f4n xuy\u00ean su\u1ed1t v\u00e0 kh\u00f4ng b\u1ecb gi\u00e1n \u0111o\u1ea1n, c\u00e1c ph\u1ea7n m\u1ec1m \u1ee9ng d\u1ee5ng s\u1ebd th\u01b0\u1eddng xuy\u00ean g\u1eedi th\u00f4ng tin (message) cho nhau, tuy nhi\u00ean trong qu\u00e1 tr\u00ecnh chia s\u1ebb th\u00f4ng tin c\u00f3 th\u1ec3&hellip;<\/p>","protected":false},"author":2,"featured_media":18003,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-18001","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kienthuc","entry","has-media"],"_links":{"self":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/18001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/comments?post=18001"}],"version-history":[{"count":0,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/18001\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media\/18003"}],"wp:attachment":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media?parent=18001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/categories?post=18001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/tags?post=18001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}