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
0 answers

Tree evaluation in Flink

I have a usecase where I want to build a realtime a decision tree evaluator using Flink. I have a decision tree something like below: Decision tree example Root Node(Product A)---- Check if price of Product A increased by $10 in last…
Cross
  • 1
0
votes
0 answers

While using Flink Stateful functions is there a simple approach to handle multiple message types from the same kafka ingress topic

I have multiple message types being consumed from the same Kafka topic ingress. While I can extend the message types to a 'wrapper' super class then downcast them after they are de-serialized, this does not seem like a good option. Are there any…
cal
  • 11
0
votes
1 answer

Is it possible to add new embedded worker while cluster is running on statefun?

Here is the deal; I'm dealing with adding new worker (embbeded) to on running the cluster (flink statefun 2.2.1). As you see the new task manager can be registered to the cluster; Screenshot of new deployed taskmanager But it doesn't initialize (it…
0
votes
1 answer

Flink event correlation and lookback

I am new to flink and looking for advice on building a realtime event correlation system. I have two main usecases: Event correlation logic comprises of static rules based on the event type coming in input stream. In last X mins, correlate events…
ekjot
  • 43
  • 5
0
votes
1 answer

Flink window aggregation with state

I would like to do a window aggregation with an early trigger logic (you can think that the aggregation is triggered either by window is closed, or by a specific event), and I read on the doc:…
0
votes
0 answers

Problem during state restore; when Flink job is submitted

We are getting the exception, copied at the end of this post. The exception is thrown when a new flink job is submitted; when Flink tries to restore the previous state. Environment: Flink version: 1.10.1 State persistence: Hadoop 3.3 Zookeeper…
vetal_king
  • 63
  • 7
0
votes
1 answer

Read all entries in a table and save it to MapState in Flink only once

I have a table Metadata. I want the contents of the table in my Flink application. So I want to read all entries in the table and save to MapState. If my application restarts, I do not want to read from table, instead, I will…
Logic
  • 2,230
  • 2
  • 24
  • 41
0
votes
1 answer

MapState always empty in a RichCoFlatMapFunction

I am reading from 2 streams. One with record and One with metadata. For the first time I want my application to build metadata by scanning complete table and save it to Flink's MapState. Updates on the table will be captured via metadata stream and…
Logic
  • 2,230
  • 2
  • 24
  • 41
0
votes
1 answer

Apache Flink, event time windows for daily shifts

My Flink job has to compute a certain aggregation after each working shift. Shifts are configurable and look something like: 1st shift: 00:00am - 06:00am 2nd shift: 06:00am - 12:00pm 3rd shift: 12:00pm - 18:00pm Shifts are the same every day for…
0
votes
1 answer

Apache Flink - FsStateBackend - How state is recovered in case of Task Manager failure which stores state in its local file system

Assume we have 2 Job Managers (ZooKeeper for HA) and 3 Task Managers. I have configured FsStateBackend for checkpointing. I assume that the FsStateBackend runs in each of the Task Managers which maintains the state in the memory. Upon checkpoint,…
0
votes
0 answers

How Flink encodes state data in CEP scenario?

I am using Flink CEP to recognize some event patterns, the query looks like select * from $TABLE MATCH_RECOGNIZE( partition by $PARTITION_FIELDS order by event_time measures ... one row per match …
0
votes
1 answer

Stateful Functions Flink Interaction with Hbase and Redis

Learning on how to use Flink Stateful Functions. I was wondering how it can interact with Hbase and Redis. I don't see any connectors for both hbase and redis in stateful functions. Does accessing these through a service via an async api call makes…
Yank Leo
  • 452
  • 5
  • 19
0
votes
1 answer

How to clear the whole MapSate state with only one call

I know that if I do mapState.clear() I will be able to clean all the values into the state for the specific key, but my question is: Is there a way to do something like mapState.clear() and clean all the states into the mapStates with just one call?…
Alter
  • 903
  • 1
  • 11
  • 27
0
votes
1 answer

Flink stateful functions : compensating callback on a timeout

I am implementing a use case in Flink stateful functions. My specification highlights that starting from a stateful function f a business workflow (in other words a group of stateful functions f1, f2, … fn are called either sequentially or in…
Mazen Ezzeddine
  • 662
  • 1
  • 8
  • 28
0
votes
0 answers

Could not find StateFunctionModule in Example, no routers are defined error

I could run Harness example here but I copied the code to another directory and use the same dependencies in pom.xml, it raised error that no routers defined I debug and found that MyModule which extends StateFunModule was not found. Thus the class…
Litchy
  • 623
  • 7
  • 23