Skip to main content

Connection Load Balancing Using Python Client?

  • June 1, 2018
  • 2 replies
  • 11 views

marcothesane
Forum|alt.badge.img+1

Dear All -

I'm personally not a Python programmer, but our customers and prospects, and some of us, are fond of the Vertica Python Client.
One of our prospects wants to test a multi-threaded data retrieval of small to medium sized result sets using Python from Vertica .
We get connection load balancing:

  • setting the -c switch while calling vsql
  • by default in JDBC and ODBC if we use the external IP address and the connection load balance policy of the database is set to its default "roundrobin"

Question is, how is that with the Vertica Python Client? A test by the customer with 4 parallel threads connecting always returned node 1 when calling "select node_name from current_session".

Can we specify something to change that while connecting at all?

Thanks and cheers -
Marco

2 replies

Jim_Knicely
Forum|alt.badge.img+2
  • Participating Frequently
  • June 1, 2018

I am not a Python programmer either, but I believe you can get Load Balancing to work via pyodbc.

See:
https://forum.vertica.com/discussion/238579/load-balancing-on-linux-from-python-clients


marcothesane
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • June 1, 2018

Thanks, Jim -
Tried the link , and also there, it says you can do it using pyodbc (and I know from experience with odb and dbman that it works in a lovely manner with ODBC) , but pyodbc is really slower then the Vertica Python Client....
Workaround for a multithreaded Vertica Python Client is to add the various IP addresses to each thread in a hard-wired manner, for now ...
Marco