Back

[SOLVED] 1 function coupled to 1 container

  • 0
  • Self Hosted
  • Functions
danilo73
14 Apr, 2023, 18:25

Hi, please @Meldiron in our previous discussion, you mention:

we spin up 1 runtime for every function

I just want to know why? It would not be better to have runtimes container that can run any funtion? that will allow a better use of server resources.

Is there a way to do this now "1 runtime container runs different functions"?

TL;DR
Title: [SOLVED] 1 function coupled to 1 container There was a discussion about the possibility of having one runtime container that can run multiple functions instead of one container per function. The response was that having separate containers is the best way to ensure isolation between functions and prevent issues. It was mentioned that in the next release, functions will be closer to HTTP standards, allowing the possibility of building a REST API on top of a single function. This architecture also helps with scaling out horizontally. It was concluded that if a developer wants to combine multiple functions into one, they can do so, but it may result in decreased isolation
danilo73
14 Apr, 2023, 18:26

1 container coupled to 1 container

Drake
14 Apr, 2023, 18:33

isolation. You wouldn't want 1 function screwing up another function. especially between different projects

Drake
14 Apr, 2023, 18:48

1 function coupled to 1 container

danilo73
14 Apr, 2023, 18:50

Is not another way to achieve isolation? I know always there are trade offs but for some limited/constrained projects it would be better to leverage server resources than have isolation.

It is a possibility that the final decision betweem isolation or server-resources, is taken by the developer?

Drake
14 Apr, 2023, 18:53

separate containers is the best way to ensure isolation. it's a pretty common architecture pattern.

If you really want, you can make 1 function that combines all your logic

Drake
14 Apr, 2023, 18:54

this architecture also helps with scaling out horizontally

Meldiron
14 Apr, 2023, 18:55

It is a possibility that the final decision betweem isolation or server-resources, is taken by the developer?

It was one of my concerns that gave us an idea for the next iteration of functions. In the next functions release, we plan to make functions closer to HTTP standards. That means, if you wanted to, you could build a full-blown REST API on top of a single Appwrite function.

Meldiron
14 Apr, 2023, 18:56

You can do that already, it's just a bit less structured. You would need to come up with a scheme for your payload, and follow that pattern in your app.

danilo73
14 Apr, 2023, 18:57

It's true, I hadn't thought about that.

danilo73
14 Apr, 2023, 19:00

wow, that is to much better, both, isolation when it is requiered or a full api otherwise.

danilo73
14 Apr, 2023, 19:02

I will try to do it in the current version. Thank you for your time

danilo73
14 Apr, 2023, 19:12

Do you know if there is a github issue about that?

Meldiron
14 Apr, 2023, 19:14

No idea. Tho no need to raise, one, this is on the roadmap, and I am actively working on it. If you are interested in more details, here is a Node.JS example (test file) using new syntax and testing all new capabilities: https://github.com/open-runtimes/open-runtimes/blob/v3/tests/resources/functions/node-18.0/tests.js

Meldiron
14 Apr, 2023, 19:14

https://github.com/open-runtimes/open-runtimes/blob/v3/tests/BaseV3.php Here is test itself so you can also check what values we send, and what responses we expect.

danilo73
14 Apr, 2023, 19:23

Thank you. I will be watching for this feature

danilo73
14 Apr, 2023, 19:23

[SOLVED] 1 function coupled to 1 container

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more