Hi!, this is probably a weird one but I need to know. Recently our API needed to connect to an external cloud (api's at AWS, psql db is at azure).
We found that the connect span took more than a second to complete. That could be explained by inter cloud latency, but.. more than a second?! And what's more confusing is the fact that queries made to the same db instance run relatively fast (200ms avg)
So my question is, what's involved in that span that could explain this latency?
The connect span represents the time it takes to call the psycopg2.connect() function. I can't really say what exactly could be slow there, as I'm not familiar enough with the internals of psycopg2. However, I do know that connecting to a PostgreSQL database can be relatively heavy, especially between cloud providers. Did you already look into connection pooling (e.g. pgbouncer) or persistent connections? That could limit the impact of latency while establishing the connection.
Thanks.
I was actually trying not to use pg_bouncer or similiar for now until I know wha's up.
May be this is a delay I cant prevent and the only solution is connection pooling.
I can't even sniff this traffic since it's all TLS.
Thanks again!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.