Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosting on serveless environments #48

Open
gmavritsakis opened this issue Nov 9, 2022 · 1 comment
Open

Hosting on serveless environments #48

gmavritsakis opened this issue Nov 9, 2022 · 1 comment

Comments

@gmavritsakis
Copy link

gmavritsakis commented Nov 9, 2022

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 ?

@jbtule
Copy link
Member

jbtule commented Nov 10, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants