I have a working Flink job built on Flink Data Stream. I want to REWRITE the entire job based on the Flink stateful functions 3.1.
The functions of my current Flink Job are:
- Read message from Kafka
- Each message is in format a slice of data packets, e.g.(s for slice):
- s-0, s-1 are for packet 0
- s-4, s-5, s-6 are for packet 1
- The job merges slices into several data packets and then sink packets to HBase
- Window functions are applied to deal with disorder of slice arrival
My Objectives
- Currently I already have Flink Stateful Functions demo running on my k8s. I want to do rewrite my entire job upon on stateful functions.
- Save data into MinIO instead of HBase
My current plan
I have read the doc and got some ideas. My plans are:
- There's no need to deal with Kafka anymore,
Kafka Ingress
(https://nightlies.apache.org/flink/flink-statefun-docs-release-3.0/docs/io-module/apache-kafka/) handles it - Rewrite my job based on java SDK. Merging are straightforward. But How about window functions?
- Maybe I should use persistent state with TTL to mimic window function behaviors
- Egress for
MinIO
is not in the list of defaultFlink I/O Connectors
, therefore I need to write my customFlink I/O Connector
forMinIO
myself, according to https://nightlies.apache.org/flink/flink-statefun-docs-release-3.0/docs/io-module/flink-connectors/ - I want to avoid
Embedded module
because it prevents scaling. Auto scaling is the key reason why I want to migrate toFlink stateful functions
My Questions
I don't feel confident with my plan. Is there anything wrong with my understandings/plan?
Are there any best practice I should refer to?
Update:
windows were used to assemble results
- get a slice, inspect its metadata and know it is the last one of the packet
- also knows the packet should contains 10 slices
- if there are already 10 slices, merge them
- if there are not enough slices yet, wait for sometime (e.g. 10 minutes) and then either merge or record packet errors.
I want to get rid of windows during the rewrite, but I don't know how