Hangfire with long running process (calling unmanaged code)

Hi,

I am not quite sure if Hangfire will help me with my problem. So I’ll just ask:

I’ve an component which is used to generate 3D CAD models. It basically consists of

  • an unmanaged C++ API
  • an managed C# wrapper for the API
  • a WCF proxy/servicehost communicating over named pipes

The component is used in a web environment. In order to properly work, each request for a 3D model has to run in its own (unmanaged) memory (if not, the model generation will crash or create erroneus models). That is the reason, why I am creating a separate process and work with WCF/NamedPipes for inter process communication. The proxy basically calls the servicehost, which then calls the unmanaged code via the C# wrapper.

In order to achieve a better performance in generating, multiple proxies and multiple(!) separate processes (servicehosts, exe) are being created. These processes take the calls from the proxies and generate the 3D models to the formats specified by the client.

E.g. if three formats are requested, three threads are being created. Each thread creates a proxy which spins up a new servicehost (in its own process). You can imagine what a bad solution this is. Especially since I’m on a system with several thousand requests per day, the machine has to work pretty hard.

Are there any mechanisms in Hangfire to perform such tasks (managed/unmanaged communication in its own process)? Maybe there are completely different approaches for such a problem?

Thanks in advance

Someone has any ideas?