{"id":21923,"date":"2025-03-25T14:35:58","date_gmt":"2025-03-25T07:35:58","guid":{"rendered":"https:\/\/gcloudvn.com\/?p=21923"},"modified":"2025-03-25T14:36:32","modified_gmt":"2025-03-25T07:36:32","slug":"best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql","status":"publish","type":"post","link":"https:\/\/gcloudvn.com\/en\/kienthuc\/best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql\/","title":{"rendered":"Best practices for achieving high availability and scalability in Cloud SQL"},"content":{"rendered":"<section class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>For today\u2019s businesses, database scalability and high availability are key to ensuring continuous operations and meeting the needs of business growth. Google Cloud SQL, with its powerful and flexible features, provides an optimal solution for managing databases in the cloud. This article will dive into the best practices for achieving scalability and high availability in Google Cloud SQL, helping you build a robust and efficient database system.<\/p>\n<p><a href=\"https:\/\/gcloudvn.com\/en\/?attachment_id=21904\" rel=\"attachment wp-att-21904\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-21904\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2025\/03\/Thang-72024-2025-03-24T144424.569.jpg\" alt=\"\" width=\"600\" height=\"375\" srcset=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2025\/03\/Thang-72024-2025-03-24T144424.569.jpg 600w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2025\/03\/Thang-72024-2025-03-24T144424.569-18x12.jpg 18w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/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\/best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql\/#Gioi_thieu\" >Introduce<\/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\/best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql\/#Danh_gia_ve_tim_kiem_vector_co_bo_loc_trong_AlloyDB\" >A review of filtered vector search in AlloyDB<\/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\/best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql\/#Loc_noi_tuyen\" >Inline filtering<\/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\/best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql\/#Quan_sat_va_giam_sat_cap_doanh_nghiep\" >Enterprise-grade observability<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/gcloudvn.com\/en\/kienthuc\/best-practices-for-achieving-high-availability-and-scalability-in-cloud-sql\/#Ket_luan\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Gioi_thieu\"><\/span>Introduce<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Many specialized vector databases today require you to create complex pipelines and applications in order to get the data you need. AlloyDB for PostgreSQL offers Google Research\u2019s, state-of-the-art vector search index, ScaNN, enabling you to optimize the end-to-end retrieval of the most fresh, relevant data with a single SQL statement.<br \/>\nToday, we are introducing a set of new enhancements to help you get even more out of vector search in AlloyDB. First, we are launching inline filtering, a major performance enhancement to filtered vector search in AlloyDB. One of the most powerful features in AlloyDB is the ability to perform filtered vector search directly in the database, instead of post-processing on the application side. Inline filtering helps ensure that these types of searches are fast, accurate, and efficient \u2014 automatically combining the best of vector indexes and traditional indexes on metadata columns to achieve better query performance.<\/p>\n<p>Second, we are launching enterprise-grade observability and management tooling for vector indexes to help you ensure stable performance and the highest quality search results. This includes a new recall evaluator, or built-in tooling for evaluating recall, a key metric of vector search quality. That means you no longer have to build your own measurement pipelines and processes for your applications to deliver good results. We\u2019re also introducing vector index distribution statistics, allowing customers with rapidly changing real-time data to achieve more stable, consistent performance.<\/p>\n<p>Together, these launches further strengthen our mission of providing performant, flexible, high-quality end-to-end solutions for vector search that enterprises can rely on.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Danh_gia_ve_tim_kiem_vector_co_bo_loc_trong_AlloyDB\"><\/span><b>A review of filtered vector search in AlloyDB<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Many customers start their journey with vector search trying simple search on a single column. For example, a retailer might want to perform a semantic search on product descriptions to surface the right products to match end-user queries.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">SELECT * FROM product<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ORDER BY embedding <\/span><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">=&gt;<\/span><span style=\"font-weight: 400;\"> embedding(&#8216;text-embedding-005&#8217;, &#8216;red cotton crew neck shirt&#8217;)::vector<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LIMIT 50;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">However, very quickly, as you look to productionize these solutions and improve the quality of your results, you may find that the queries themselves get more interesting. You might iterate \u2014 add filters, perform joins with other tables, and aggregate your data. For example, the retailer might want to allow users to filter by size, price, and more.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">SELECT * FROM product<\/span><\/p>\n<p><span style=\"font-weight: 400;\">WHERE category=&#8217;shirt&#8217;<\/span><span style=\"font-weight: 400;\">&amp;&amp;<\/span><span style=\"font-weight: 400;\"> size=&#8217;S&#8217;<\/span><span style=\"font-weight: 400;\">&amp;&amp;<\/span><span style=\"font-weight: 400;\"> price<\/span><span style=\"font-weight: 400;\">&lt;100<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ORDER<\/span> <span style=\"font-weight: 400;\">BY<\/span> <span style=\"font-weight: 400;\">embedding<\/span> <span style=\"font-weight: 400;\">&lt;=&gt; embedding(&#8216;text-embedding-005&#8217;, &#8216;red cotton crew neck&#8217;)::vector<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LIMIT 50;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">AlloyDB\u2019s PostgreSQL interface provides a strong developer experience for these types of workloads. Because vector search is integrated into the SQL interface, developers can very easily query structured and unstructured data together in a single SQL statement, as opposed to writing complex application code that pulls data from multiple sources.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Moreover, changing requirements such as adding new query filters typically don\u2019t require schema or index updates. If our retailer, for example, wants to only show in-stock items at the end user\u2019s local store, they can very easily join their products table with an existing store inventory table via the SQL interface.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">SELECT * FROM product p<\/span><\/p>\n<p><span style=\"font-weight: 400;\">JOIN product_inventory pi ON p.id = pi.product_id<\/span><\/p>\n<p><span style=\"font-weight: 400;\">WHERE category=&#8217;shirt&#8217; <\/span><span style=\"font-weight: 400;\">&amp;&amp;<\/span><span style=\"font-weight: 400;\"> pi.inventory&gt;0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ORDER BY embedding <\/span><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">=&gt;<\/span><span style=\"font-weight: 400;\"> embedding(&#8216;text-embedding-005&#8217;, &#8216;red cotton crew neck&#8217;)::vector<\/span><\/p>\n<p><span style=\"font-weight: 400;\">LIMIT 50;<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Loc_noi_tuyen\"><\/span><strong>Inline filtering<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">But as a developer, you don't just want to execute queries \u2014 you want high performance and good memory. To deliver optimal performance, AlloyDB's query optimizer automatically chooses how to execute filtered queries.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Inline filtering is a new query optimization technique that allows AlloyDB's optimizer to simultaneously evaluate both metadata filtering and vector search conditions, leveraging both vector indexes and indexes on metadata columns. Inline filtering is now available for the ScaNN index in AlloyDB, a search technology based on over a decade of Google's research into semantic search algorithms.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">AlloyDB automatically applies this technique when it is most beneficial. Depending on the query and data distribution, the query planner automatically chooses the execution plan that provides the best performance:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">When a filter has high selectivity\u2014that is, only a small number of rows satisfy the filter condition\u2014the planner typically performs a pre-filter. This approach leverages an index on the metadata column to find a small subset of matching rows, and then performs a nearest-neighbor search on these rows.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">When the filter has low selectivity \u2013 that is, most rows match the filter condition \u2013 the planner can perform post-filtering. This method starts with the vector index to find a list of matching results, then eliminates results that do not meet the conditions on the metadata columns.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Inline filtering works best with medium selectivity. When AlloyDB searches through a vector index, it only calculates distances for vectors that satisfy the filtering criteria on the metadata. This significantly improves query performance, adding the benefits of both pre- and post-filtering.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">With this feature, AlloyDB delivers superior performance across the entire filter selectivity spectrum when combined with vector search.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Watch the demo video to learn more about how this feature works: <\/span><a href=\"https:\/\/www.youtube.com\/watch?v=L5XRdSHEE3I\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/www.youtube.com\/watch?v=L5XRdSHEE3I<\/span><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Quan_sat_va_giam_sat_cap_doanh_nghiep\"><\/span><b>Enterprise-grade observability<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">N\u1ebfu b\u1ea1n \u0111ang ch\u1ea1y t\u00ecm ki\u1ebfm t\u01b0\u01a1ng \u0111\u1ed3ng (similarity search) ho\u1eb7c kh\u1ed1i l\u01b0\u1ee3ng c\u00f4ng vi\u1ec7c AI t\u1ea1o sinh (generative AI) trong m\u00f4i tr\u01b0\u1eddng s\u1ea3n xu\u1ea5t, b\u1ea1n c\u1ea7n hi\u1ec7u su\u1ea5t \u1ed5n \u0111\u1ecbnh v\u00e0 ch\u1ea5t l\u01b0\u1ee3ng k\u1ebft qu\u1ea3 cao, gi\u1ed1ng nh\u01b0 v\u1edbi b\u1ea5t k\u1ef3 kh\u1ed1i l\u01b0\u1ee3ng c\u00f4ng vi\u1ec7c c\u01a1 s\u1edf d\u1eef li\u1ec7u n\u00e0o kh\u00e1c. C\u00f4ng c\u1ee5 quan s\u00e1t v\u00e0 qu\u1ea3n l\u00fd l\u00e0 y\u1ebfu t\u1ed1 then ch\u1ed1t \u0111\u1ec3 \u0111\u1ea1t \u0111\u01b0\u1ee3c \u0111i\u1ec1u n\u00e0y.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">With the new recall evaluator, built directly into the database, you can now more systematically measure, and ultimately tune, search quality with a single stored procedure in the database rather than build custom evaluation pipelines.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Recall in similarity search is the fraction of relevant instances that were retrieved from a search, and is the most common metric used for measuring search quality. One source of recall loss comes from the difference between approximate nearest neighbor search, or aNN, and k (exact) nearest neighbor search, or kNN. Vector indexes like AlloyDB\u2019s ScaNN implement aNN algorithms, allowing you to speed up vector search on large datasets in exchange for a small tradeoff in recall. Now, AlloyDB provides you with the ability to measure this tradeoff directly in the database for individual queries and ensure that it is stable over time. You can update query and index parameters in response to this information to achieve better results and performance. This management tooling is critical if you care deeply about stable, high-quality results.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In addition to recall improvements, we\u2019re also introducing vector index distribution statistics for the ScaNN index, allowing developers to see the distribution of vectors within the index. This is particularly useful for workloads with high write throughput or data change rates. In these scenarios, new real-time data is automatically added to the index and is ready for querying right away. Now, you can monitor any changes in vector-index distribution, and ensure that performance stays robust through these data changes.<\/span><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Ket_luan\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p data-sourcepos=\"1:1-1:470\">In summary, achieving high scalability and availability in Google Cloud SQL requires a combination of intelligent system design, configuration optimization, and effective use of platform features. By applying the best practices presented in this article, businesses can build a robust, flexible, and reliable database system that can meet growth needs and ensure continuous operations in a volatile business environment.<\/p>\n<p data-sourcepos=\"3:1-3:241\">Remember, there is no one-size-fits-all solution. Businesses need to carefully evaluate their specific requirements and choose the most appropriate methods to achieve their scalability and high availability goals.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div class=\"templatera_shortcode\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div class=\"vc_message_box vc_message_box-standard vc_message_box-rounded vc_color-blue\" ><div class=\"vc_message_box-icon\"><i class=\"vc-mono vc-mono-technorati\"><\/i><\/div><p><a href=\"https:\/\/gcloudvn.com\/en\/main-logo-1\/\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-664\" src=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/06\/main-logo-1.png\" alt=\"\" width=\"221\" height=\"72\" srcset=\"https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/06\/main-logo-1.png 214w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/06\/main-logo-1-18x6.png 18w, https:\/\/gcloudvn.com\/wp-content\/uploads\/2021\/06\/main-logo-1-183x60.png 183w\" sizes=\"auto, (max-width: 221px) 100vw, 221px\" \/><\/a>As a senior partner of Google in Vietnam, Gimasys has more than 10+ years of experience, consulting on implementing digital transformation for 2000+ domestic corporations. Some typical customers Jetstar, Dien Quan Media, Heineken, Jollibee, Vietnam Airline, HSC, SSI...<\/p>\n<p>Gimasys is currently a strategic partner of many major technology companies in the world such as Salesforce, Oracle Netsuite, Tableau, Mulesoft.<\/p>\n<p>Contact Gimasys - Google Cloud Premier Partner for advice on strategic solutions suitable to the specific needs of your business:<\/p>\n<ul>\n<li>Email: gcp@gimasys.com<\/li>\n<li>Hotline: 0974 417 099<\/li>\n<\/ul>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/div>\n<\/section>","protected":false},"excerpt":{"rendered":"\u0110\u1ed1i v\u1edbi c\u00e1c doanh nghi\u1ec7p hi\u1ec7n nay, kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u00e0 \u0111\u1ed9 kh\u1ea3 d\u1ee5ng cao c\u1ee7a c\u01a1 s\u1edf d\u1eef li\u1ec7u l\u00e0 y\u1ebfu t\u1ed1 then ch\u1ed1t \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o ho\u1ea1t \u0111\u1ed9ng li\u00ean t\u1ee5c v\u00e0 \u0111\u00e1p \u1ee9ng nhu c\u1ea7u t\u0103ng tr\u01b0\u1edfng&hellip;","protected":false},"author":2,"featured_media":21905,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1,135],"tags":[],"class_list":["post-21923","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kienthuc","category-google-cloud-platform","entry","has-media"],"_links":{"self":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/21923","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=21923"}],"version-history":[{"count":0,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/posts\/21923\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media\/21905"}],"wp:attachment":[{"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/media?parent=21923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/categories?post=21923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gcloudvn.com\/en\/wp-json\/wp\/v2\/tags?post=21923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}