I understand there are two ways for dockerized application to cennect to Cloud SQL database:
Which one is faster?
There is a bit of confusion here - by cloud_sql
sidecar, you are referring to using the Cloud SQL proxy in a sidecar pattern as described here.
The proxy has two different connection methods - it uses either Public IP or Private IP when connecting to your Cloud SQL instance. You can specify which you want it to use with the --ip_address_types
flag (example).
When it comes to latency between Public and Private IPs, Private IP are typically faster. This is because private IPs stay local within Google's infrastructure.