impromptu-interface icon indicating copy to clipboard operation
impromptu-interface copied to clipboard

Hosting on serveless environments

Open gmavritsakis opened this issue 3 years ago • 1 comments

Hi, taking into consideration the fact that impromptu-interface uses reflection.emit to generate the proxies, I suppose using this technique on a serverless/microservices environment where services are spawned upon request would not be suggested, as the proxies must be regenerated every time a new instance of the service is started.

So do you indeed discourage the use on such environments ? Is there any way to cache the proxies between different instances ?

gmavritsakis avatar Nov 09 '22 20:11 gmavritsakis

If you are measuring it and find it too slow than I suggest you don't use it. The types it emits are pretty lightweight, so shouldn't slow things down too much. There used to be a way to pre-save the emitted DLLs but that disappeared for .net standard.

The proxies it implements are essentially in C#:

public class Test:ITestInterface {
   dynamic target;
   public int Prop1 => target.Prop1
   public void Method1() => target.Method1();
  //etc

So you could always implement your own and see if you get a speed bump.

jbtule avatar Nov 10 '22 14:11 jbtule