I'm writing an ASP.NET page intended for multiple users. On the backend we have datatypes that are primarily mathematical, and interact with Mathematica for string-to-double evaluations, among others. We need to make these evaluations up to 100 times per second per user, for up to 100 users, say. But every time we use NETLink to create a new kernel connection, a new instance of the Mathematica kernel opens on the host machine. 10,000 copies of the Mathematica kernel on a single machine is obviously undesirable.

If we were guaranteed to have one user, it might work to create a global kernel and use that -- but if we have 100 users, that would create 100 kernels, which is still excessive. Is there a nice workaround for this? Perhaps a way to use .NETLink to a kernel that's already opened?

  • $\begingroup$ How about defining kernel as singleton and in the kernel define context for each user. $\endgroup$
    – s.s.o
    Mar 4, 2013 at 10:08
  • $\begingroup$ Have you looked at webMathematica? It is Java based, so it isn't a perfect fit for your ASP.NET setup, but it has the key feature you seem to need: it provides a queueing system for access to a pool of preinitialized kernels. It is also possible to create webservices which use such a pool of kernels and which your ASP.NET application could use. You even might ask the support at WRI whether it is possible to use only the kernel pool feature from ASP.NET more directly... $\endgroup$ Mar 4, 2013 at 10:38


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.