0

I have a few question about the remote deployment of functions as shown the diagram:

If have remote statefun functions (multiple instance with the Undertow as shown in the examples fronted by api gateway):

  1. Do we need to configure the api gateway to send calls with same url to the same backend hosting the function or does the frame work take care of it ?
  2. From my understanding each function is keeping local state. If one instance is relocated, or we scale the functions, how does the local state get redistributed ?

If there is any documentation, on this, please let me know.

Thanks.

1 Answers1

0

The functions are stateless. All of the state they need in order to respond to an invocation is included in the message, and the response will include any updates to the state that are needed. Because they are stateless there's no need to worry about sessions or instance affinity or rescaling for remote functions.

The developers have given talks that get into some of these details. I'll suggest a talk by Tzu-Li (Gordon) Tai, Stateful Functions: Polyglot Event-Driven Functions for Stateful Distributed Applications.

David Anderson
  • 39,434
  • 4
  • 33
  • 60
  • Thanks David for your pointers. If the state becomes too large, will it impact the invocation since the state is being shuttled with each remote request/response ? Are there any guidelines for such scenarios ? Thanks again. – mans2singh Apr 22 '22 at 14:59
  • The state that is sent is only the specific state needed to respond to that one request. So it's unusual for that to be so large as to cause performance problems. If it does, you can consider using embedded functions, but that's a rather painful fallback. – David Anderson Apr 23 '22 at 10:54