Questions tagged [flink-statefun]

Stateful Functions is an API that simplifies building distributed stateful applications. It’s based on functions with persistent state that can interact dynamically with strong consistency guarantees. The runtime is built on Apache Flink®.

Stateful Functions Applications

A stateful function is a small piece of logic/code existing in multiple instances that represent entities — similar to actors. Functions are invoked through messages and are:

  • Stateful: Functions have embedded, fault-tolerant state, accessed locally like a variable.
  • Virtual: Much like FaaS, functions don't reserve resources — inactive functions don't consume CPU/Memory.

Applications are composed of modules of multiple functions that can interact arbitrarily with:

  • Exactly-once Semantics: State and messaging go hand-in-hand, providing exactly-once message/state semantics.
  • Logical Addressing: Functions message each other by logical addresses. No service discovery needed.
  • Dynamic and Cyclic Messaging: Messaging patterns don't need to be pre-defined as dataflows (dynamic) and are also not restricted to DAGs (cyclic).

A Runtime built for Serverless Architectures

The Stateful Functions runtime is designed to provide a set of properties similar to what characterizes serverless functions, but applied to stateful problems.

The runtime is built on Apache Flink, with the following design principles:

  • Logical Compute/State Co-location: Messaging, state access/updates and function invocations are managed tightly together. This ensures a high-level of consistency out-of-the-box.
  • Physical Compute/State Separation: Functions can be executed remotely, with message and state access provided as part of the invocation request. This way, functions can be managed like stateless processes and support rapid scaling, rolling upgrades and other common operational patterns.
  • Language Independence: Function invocations use a simple HTTP/gRPC-based protocol so that Functions can be easily implemented in various languages.

References

89 questions
0
votes
2 answers

Flink StatefulFunction reacting to a checkpoint?

My stateful function is writing data to a database, but it is nondeterministic so restoring from a checkpoint can result in the database containing inconsistent data. My idea is to 'buffer' data in Flink's persistent state and only write the data to…
weequ
  • 5
  • 1
0
votes
1 answer

Flink stateful function address resolution for messaging

In Flink datastream suppose that an upstream operator is hosted on machine/task manager m, How does the upstream operator knows the machine (task manager) m’ on which the downstream operator is hosted. Is it during initial scheduling of the job…
0
votes
1 answer

Apache Flink Stateful Function - Serialization problem?

I'm trying to build a project using an Apache Flink Stateful Function in Python, but I can't seem to get it to work. What I've narrowed the issue down to is that it seems when I send the request to my stateful function through my protobuf schema,…
0
votes
1 answer

Flink Statefun Bootstrap and State expiration

According to this page we have the ability to set TTL for state when using Flink Statefun v2.1.0. We also have the ability to bootstrap state, according to this page. First question is, bootstrap documentation does not mention state expiration at…
keremulutas
  • 534
  • 5
  • 16
0
votes
1 answer

Flink stateful functions, async calls with the python SDK

I'm trying out the Stateful Functions 2.1 API with the Python SDK and I can't see a clear way on how to make async calls to external api's without blocking the application. Is this possible or can somebody send me on the right path?
user3499430
  • 17
  • 1
  • 1
  • 6
0
votes
2 answers

Flink statefun and confluent schema registry compatibility

I'm trying to egress to confluent kafka from flink statefun. In confluent git repo in order to schema check and put data to kafka topic all we need to do is use kafka client ProducerRecord object with avro object. But in statefun we need to override…
0
votes
3 answers

statefun is giving org.apache.flink.client.program.ProgramInvocationException classloader.parent-first-patterns.additional;

I am running stateful-fun 2.0 basic hello job with the following command ./bin/flink run -c org.apache.flink.statefun.flink.core.StatefulFunctionsJob ./stateful-sun-hello-java-1.0-SNAPSHOT-jar-with-dependencies.jar and my POM.xml is
dinesh c
  • 1
  • 1
0
votes
1 answer

Is it possible to write a unit test which terminates using flink statefun Harness?

I'm working on a new project using flink stateful functions. I've written some basic unit tests using FunctionTestHarness, but a test using this method can't test interaction between stateful functions. The flink testing documentation (base flink,…
Fred Fettinger
  • 218
  • 2
  • 5
0
votes
1 answer

Apache Flink Stateful Functions state scaling

We are able to scale stateless functions as much as we want. But stateful functions likely to be bottleneck if we don't scale them as we scale stateless functions. Scaling state seems to be tricky because of the distribution of the data across the…
0
votes
1 answer

Apache Flink Stateful Functions forwarding the same message to N functions

I'm trying to send incoming messages to multiple stateful functions but I couldn't fully understand how to do. For the sake of understandability let's say one of my stateful function getting some integers and sending them to couple of remote…
0
votes
1 answer

apache flink statefun python sdk build distribution problem

I had plan to communicate embedded stateful functions with python statefun example (link: https://github.com/apache/flink-statefun/tree/master/statefun-examples/statefun-python-greeter-example) But (there is always a but) I had struggled to build…
0
votes
1 answer

Stateful Functions Remote Module in Apache Flink

When I examine State functions modules I found below results. https://ci.apache.org/projects/flink/flink-statefun-docs-release-2.0/sdk/python.html -> The Python SDK is supported as a remote…
Anıl Sevici
  • 214
  • 2
  • 12
0
votes
1 answer

Flink Stateful Functions 2.0 Multiple Calls During Asynchronous Wait

Flink Stateful Functions 2.0 has the ability to make asychronous calls, for example to an external API: [https://ci.apache.org/projects/flink/flink-statefun-docs-release-2.0/sdk/java.html#completing-async-requests][1]. Function execution is then…
-1
votes
1 answer

How to specify the time for which the state should be maintained in Flink CEP

Let me explain a scenario which I need to handle. Let us assume three devices A,B,C are sending logs to the flink CEP for processing. Let us assume the pattern as A followed by 5 mins B which is followed by C in 5 mins. Let us assume a scenario…
1 2 3 4 5
6