Cloud SQL
1. Cloud SQL
Let's dive into the structured or relational database services. First up is Cloud SQL. Why would you use a Google Cloud service for SQL, when you can install a SQL Server application image on a VM using Compute Engine? The question really is, should you build your own database solution or use a managed service? There are benefits to using a managed service, so let's learn about why you'd use Cloud SQL as a managed service inside of Google Cloud. Cloud SQL is a fully managed service of either MySQL, PostgreSQL, or Microsoft SQL Server databases. This means that patches and updates are automatically applied, but you still have to administer MySQL users with the native authentication tools that come with these databases. Cloud SQL supports many clients, such as Cloud Shell, App Engine, and Google Workspace scripts. It also supports other applications and tools that you might be used to like SQL Workbench, Toad, and other external applications using standard MySQL drivers. Cloud SQL delivers high performance and scalability with up to 64 TB of storage capacity, 60,000 IOPS, and 624 GB of RAM per instance. You can easily scale up to 96 processor cores and scale out with read replicas. Currently, you can use Cloud SQL with either MySQL 5.6, 5.7, or 8.0, PostgreSQL 9.6, 10, 11, 12, 13, 14, or 15, or either of the Web, Express, Standard, or Enterprise SQL Server 2017 or 2019 editions. Let's focus on some other services provided by Cloud SQL. In High Availability configuration, within a regional instance, the configuration is made up of a primary instance and a standby instance. Through synchronous replication to each zone's persistent disk, all writes made to the primary instance are replicated to disks in both zones before a transaction is reported as committed. In the event of an instance or zone failure, the persistent disk is attached to the standby instance, and it becomes the new primary instance. Users are then rerouted to the new primary. This process is called a failover. Cloud SQL also provides automated and on-demand backups with point-in-time recovery. You can import and export databases using mysqldump, or import and export CSV files. Cloud SQL can also scale up, which does require a machine restart or scale out using read replicas. That being said, if you are concerned about horizontal scalability, you'll want to consider Spanner, which we'll cover later in this module. Choosing a connection type to your Cloud SQL instance will affect how secure, performant, and automated it will be. If you're connecting an application that is hosted within the same Google Cloud project as your Cloud SQL instance, and it's collocated in the same region, choosing the Private IP connection will provide you with the most performant and secure connection using private connectivity. In other words, traffic is never exposed to the public internet. Note that connecting to the Cloud SQL Private IP address from VMs in the same region is only a performance-based recommendation and not a requirement. If the application is hosted in another region or project, or if you're trying to connect to your Cloud SQL instance from outside of Google Cloud, you have 3 options. In this case, I recommend using the Cloud SQL Auth Proxy, which handles authentication, encryption, and key rotation for you. If you need manual control over the SSL connection, you can generate and periodically rotate the certificates yourself. Otherwise, you can use an unencrypted connection by authorizing a specific IP address to connect to your SQL server over its external IP address. You will explore these options in an upcoming lab. To summarize, let's explore this decision tree to help you find the right data storage service with full relational capability. Memorystore provides a fully-managed in-memory data store service for workloads requiring microsecond response times, or that have large spikes in traffic, as seen in gaming environments and real-time analytics. If you don't need an in-memory data store, but your use case is relational data used primarily for analytics, these workloads are best supported by BigQuery. However, if your relational data workload isn't analytics, the choice lies between Spanner and Cloud SQL. If you don't need horizontal scaling or a globally available system, Cloud SQL is a cost-effective solution.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.