WEBMATHEMATICA TUTORIAL

Multiple Kernel Pools

For some applications, it is useful to use several pools of Mathematica kernels to serve different requests. You can configure the kernels in each pool differently, perhaps with different timeout parameters or different initialization files. Another possibility would be to use a pool with one Mathematica kernel as a demonstration server and another pool with four Mathematica kernels to serve customer requests. This would ensure that the customers received priority. Another benefit of multiple pools is the guarantee that one set of computations is completely isolated from another. Disadvantages, however, are the additional administration and the need for extra webMathematica licenses.

The different pools are all configured in the MSPConfiguration.xml file. By default, one pool is created, called the General pool. If you wish to configure for additional pools, add a KernelPool section to the MSPConfiguration.xml file, as shown below.

<KernelPool>
<KernelPoolName>Longer</KernelPoolName>
<KernelExecutable>C:\Program Files\Wolfram Research\Mathematica\10.0\math.exe</KernelExecutable>
<KernelTimeLimit>60000</KernelTimeLimit>
<URLPattern>/Longer/*</URLPattern>
</KernelPool>

This creates a pool called Longer, with a time limit of 60 seconds. Any URL that starts with Longer will use this pool. The documentation on MSPConfiguration.xml describes the configuration parameters that can be placed in these files.

If you wish to work with multiple pools, you need to have webMathematica licenses for all the kernels you wish to run. The Kernel Monitor contains information on all the pools, so this is a good place to confirm that a pool has been properly initialized. The servlet log files also contain information about each pool, as the section on Logging describes.

Multiple Web Applications

Yet another way to divide requests is to install multiple web applications. This might be beneficial if your server provides special configuration tools for web applications. For this you would repeat the installation process for the webMathematica web application, giving each new installation a different name. All web applications that are run in the same instance of the Java Virtual Machine will share the same Kernel Monitor.