Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I run mysql on google cloud run? (or any database)

I've been researching the new options to run Docker containers in Google Cloud Run, however, there seems to be no advice on whether or not one should run MySQL on Cloud run, apparently, I know it isn't a web service, and I understand in the Official Google Documentation for GCP, Google would probably just tell people to kindly use Cloud SQL (their SQL Offering), I haven't found any advice online about "running mysql on cloud run", so I thought I'd ask here. Will startup times from cold starts decrease performance of the solution? (assuming one uses a Bucket for storing the stuff)

like image 960
Felipe Valdes Avatar asked Jul 12 '19 10:07

Felipe Valdes


People also ask

Can I use MySQL on Google Cloud?

You can use Cloud SQL, Google Cloud Marketplace, or manually install MySQL on Compute Engine. Cloud SQL offers MySQL as a web service. You can use Cloud SQL to host your MySQL database in Google's cloud, and let Google Cloud handle administrative duties like replication, patch management, and database management.

When should I use Google Cloud database?

In Google Cloud use Cloud SQL for any general-purpose SQL database and Cloud Spanner for large-scale globally scalable, strongly consistent use cases. In general, if your data structure may change later and if scale and availability is a bigger requirement then a non-relational database is a preferable choice.

Is MySQL better than another database?

MySQL server has a much more sophisticated privilege system than PostgreSQL. While PostgreSQL only supports INSERT, SELECT, and UPDATE/DELETE grants per user on a database or a table, MySQL server allows you to define a full set of different privileges on the database, table, and column level.

Is Google Cloud SQL good?

It is one of the excellent database to use. Google cloud SQL delivers high performance and scalability . Cloud service is best way to manage varieties of databases like (MYSQL, PostgreSQL, SQL server). It is very to use and easy to setup.


1 Answers

Running a SQL database is not a good fit for Cloud Run.

First of all, the contract between the deployed container and Cloud Run is that the container needs to run an HTTP server on port 8080. That's not really the way MySQL works.

Second of all, the container is going to be limited to the filesystem that was included in the container image. This same image is going to be instantiated many times over as the service handles load. There will be no way to persist the data written to MySQL. You could have read-only data stored in that image that only changes when a new image is published, but that's not really what you would expect to use a relational database for.

Cloud Run is really good at operating HTTP/web services in a serverless and scalable way. These web services typically make use of other APIs and service deployed to Google Cloud, or third party services. It's not really meant to offer persistent, scalable, ACID-compliant database services - this is a whole different sort of problem space.

like image 117
Doug Stevenson Avatar answered Nov 15 '22 10:11

Doug Stevenson