Java UDF and Socket (TCP/UDP) Connections

Extensibility
Fan

Java UDF and Socket (TCP/UDP) Connections

We need to make UDP connections from Java UDF functions to run some external processing. This processing is multithreaded and we can serve up to 100 concurrent requests.

The problem we experience is that the Teradata server does not open more than 2 UDP/IP connections at any one time. 

Is there a configuration parameter for that? If so, how can we change it?

Any help much appreciated.

7 REPLIES
Teradata Employee

Re: Java UDF and Socket (TCP/UDP) Connections

What kind of Java UDF did you make? Is it a table function?

A table function is executed on each AMP, once per AMP. So if your system has 2 AMPs, then your table function would be executed twice. If your system has more than 2 AMPs, then your table function would be executed more times.

Fan

Re: Java UDF and Socket (TCP/UDP) Connections

Hi, it is a scalar UDF - VARCHAR in, VARCHAR out. 

Would similar limit based on the number of AMPs apply to TCP/UDP connections?

Teradata Employee

Re: Java UDF and Socket (TCP/UDP) Connections

I am not aware of any limit imposed on outgoing TCP or UDP connections from Java UDFs to remote systems.

Fan

Re: Java UDF and Socket (TCP/UDP) Connections

For testing, we created an Express instance on Amazon. We ran Java UDF - scalar, one varchar / column in, another varchar out. The UDF included sending and receiving a UDP packet to a simple server (multi-threaded to accept connections in parallel).

We only managed to get one connection from TD at any one time. (We did this by increasing response time to UDP requests and counting number of served packets).

Is there anything we can try in terms of TD configuration to increase the number of concurrent UDP connections?

Or anything that springs to mind that could cause this?

Teradata Employee

Re: Java UDF and Socket (TCP/UDP) Connections

Depending on your query, a scalar UDF might execute only once, for example: SELECT MyUdf('foo')

That would explain why you only see one UDP connection at a time.

Fan

Re: Java UDF and Socket (TCP/UDP) Connections

yes, the query is exactly as you mention SELECT transform(column) FROM table.

Is there a way to increase the number of executions?

Teradata Employee

Re: Java UDF and Socket (TCP/UDP) Connections

If your query is SELECT transform(column) FROM table, then your "transform" UDF will be called once per row. Make sure there are multiple rows in the table, then your UDF will be called multiple times.