All Forums Extensibility
dc352 4 posts Joined 10/13
14 Oct 2013
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.

tomnolan 594 posts Joined 01/08
15 Oct 2013

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.

dc352 4 posts Joined 10/13
18 Oct 2013

Hi, it is a scalar UDF - VARCHAR in, VARCHAR out. 
Would similar limit based on the number of AMPs apply to TCP/UDP connections?

tomnolan 594 posts Joined 01/08
18 Oct 2013

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

dc352 4 posts Joined 10/13
28 Oct 2013

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?
 

tomnolan 594 posts Joined 01/08
29 Oct 2013

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.

dc352 4 posts Joined 10/13
30 Oct 2013

yes, the query is exactly as you mention SELECT transform(column) FROM table.
Is there a way to increase the number of executions?

tomnolan 594 posts Joined 01/08
30 Oct 2013

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.

You must sign in to leave a comment.