Anyone using MySQL on Google Cloud?

Having fairly significant connectivity stability issues whenever there is some concurrency. What is unique about Gcloud is they use unix sockets for an internal connection between their app components and the database. DB load is overall minimal.

connection looks like this:

           String dbSocketDir = Environment.GetEnvironmentVariable("DB_SOCKET_PATH") ?? "/cloudsql";
            String instanceConnectionName = Environment.GetEnvironmentVariable("INSTANCE_CONNECTION_NAME");
            var connectionString = new MySqlConnectionStringBuilder()
                // The Cloud SQL proxy provides encryption between the proxy and instance.
                SslMode = MySqlSslMode.None,
                Server = String.Format("{0}/{1}", dbSocketDir, instanceConnectionName),
                UserID = Environment.GetEnvironmentVariable("DB_USER"),  
                Password = Environment.GetEnvironmentVariable("DB_PASS"),
                Database = Environment.GetEnvironmentVariable("DB_NAME"),
                ConnectionProtocol = MySqlConnectionProtocol.UnixSocket,
            sqlConstr = connectionString.ConnectionString;

          OrmLiteConnectionFactory factory = new OrmLiteConnectionFactory(sqlConstr, MySqlDialect.Provider);


            container.Register<IDbConnectionFactory>(c => factory);

stack trace here (sorry, don’t have textual version of stack trace.

That wont be anything OrmLite has any control over, would need to be resolved at Oracle’s MySql.Data ADO .NET Provider or Gcloud, who may be able to recommend a specific connection string configuration that’s more reliable for usage with their servers.

For posterity… I found the culprit… CPU starvation while running MQ requests.

Google Cloud Run has an interesting aspect to its serverless container “Run”

“After startup, you should only expect to be able to do computation within the scope of a request: a container instance does not have any CPU allocated if it is not processing a request.”

This saves you a lot of money over fargate and azure container instances because you don’t get charged for idle time but it make running batch a bit more difficult :slight_smile: LOL.

Yeah I wouldn’t expect you should be running background threads on transient cloud lambda/functions.

What’s the pricing compared vs AWS lambda? do they also have a generous free tier?

Run is different than Lambda, it is full blown containers… (I like them because I can run redis, various drivers, shell tools, binaries, etc etc ). Have not compared to cpu time on lambda… free tier is:

2 million requests per month
360,000 GB-seconds of memory, 180,000 vCPU-seconds of compute time
1 GB network egress from North America per month

AWS lambda also does containers

Ok that’s better than Lambda’s 1M free requests per month