Home | Previous Page | Next Page   Improving UDR Performance > Using a Virtual-Processor Class >

Choosing a Virtual-Processor Class

The database server supports the following classes of virtual processors for the execution of a UDR.

Virtual-Processor Class Description
CPU VP Required VP for execution of SPL routines Default VP for execution of C UDRs. A UDR must be well behaved to run in the CPU VP.
User-defined VP VP for execution of C UDR that has some ill-behaved characteristics but does not contain system() functions. For information on system() functions, see Using Operating System Functions.
JVP VP for execution of Java UDRThis VP class contains the Java Virtual Machine (Java VM).

The database server defines the CPU VP and the JVP classes.

CPU Virtual-Processor Class

The CPU virtual-processor class is the primary VP class of the database server. It runs the following kinds of threads:

The CPU VP class is the default VP class for a UDR. You do not need to specify the CLASS routine modifier in the CREATE FUNCTION or CREATE PROCEDURE statement to have the UDR execute in the CPU VP class.

Stored Procedure Language Support

SPL routines must always run in the CPU VP. Therefore, you do not need to specify the CLASS routine modifier for an SPL routine. The following CREATE FUNCTION statement registers the getTotal() SPL routine, which runs in the CPU VP:

CREATE FUNCTION getTotal(order_num, state_code)
   RETURNS MONEY
...
END FUNCTION

You cannot run an SPL routine in a user-defined VP.

End of Stored Procedure Language Support
C Language Support

By default, a C UDR runs in the CPU VP class. Generally, UDRs perform best in the CPU VP class because threads do not have to migrate among operating-system processes during query execution. However, to run in the CPU VP, the C UDR must be well behaved; that is, it must adhere to the following programming requirements:

Important:
Use the CPU VP with caution. If a UDR contains errors or does not adhere to these guidelines, this routine might affect the normal processing of other user queries.

You can relax some of these programming requirements if you run your C UDR in a user-defined VP class. For more information, see User-Defined Virtual-Processor Class (C).

End of C Language Support

User-Defined Virtual-Processor Class (C)

For routines written in C, you can designate a user-defined class of virtual processors, called user-defined VPs, to run the routine.

Use of user-defined VPs can result in lower performance because queries normally execute in the CPU VP, and the query thread must migrate to the user-defined VP to evaluate external routines.

JVM Virtual-Processor Class (Java)

Java routines always run in a Java VP. When you register a Java, you can specify the following CLASS routine modifier for legibility, but it is not required:

CLASS = jvp
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]