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

Using Virtual Processors with UDRs Written in C

To run in the CPU VP class, a C UDR must be well behaved; that is, it must adhere to special programming requirements. Running in a user-defined VP relaxes some, but not all, of the programming requirements of a well-behaved routine. For example, these routines can issue direct file-system calls that block further processing by the virtual processor until the I/O is complete. Because virtual processors are not CPU virtual processors, however, the normal processing of user queries is not affected. However, they still cannot perform local resource allocations because they might migrate among the VPs.

Tip:
The DataBlade Developers corner of the IBM Informix Developer Zone (www.ibm.com/software/data/developer/informix) has a detailed article about data safety when using operating-system functions with user-defined VPs.
To assign a C UDR to a user-defined VP class
  1. When you register an external function or procedure, assign it to a class of virtual processors with the CLASS routine modifier of the CREATE FUNCTION or CREATE PROCEDURE statement.

    The CLASS routine modifier specifies the virtual-processor class with the following syntax:

    CLASS = vpclass_name

    In this syntax, vpclass_name is the name of the user-defined VP class that you have configured in the database server. The class name is not case sensitive.

  2. Configure new user-defined virtual-processor classes in the ONCONFIG file with the VPCLASS configuration parameter.

    The following sample ONCONFIG entry creates the user-defined VP class newvp:

    VPCLASS newvp,num=3                      # New VP class for testing

    The num option specifies the number of virtual processors that the database server starts. For the newvp virtual-processor class, the database server initially starts three virtual processors.

The VP class need not exist when the routine is registered. However, when you execute the routine, the class must exist and have virtual processors assigned to it. If the class does not have any virtual processors, you receive an SQL error.

For more information on how to choose a virtual-processor class for a C UDR, see the IBM Informix: DataBlade API Programmer's Guide. For information on the VPCLASS configuration parameter, see the IBM Informix: Administrator's Reference.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]