Vjeran Crnjak
03/18/2024, 11:46 AMGetRecords on Kinesis input stream is called too many times. I've adjusted the retry options to make the Job green but I'd like to fix the issue.
I assume that after computation is committed, instead of having a nice DAG, there's something in my setup that separates the computation into parallel tasks (I assume it's the conversion from table env to datastream env).
The problem this creates is that instead of calling GetRecords once on a kinesis shard, each of the 15+ tasks calls it for itself, exceeding 5 calls per second limit set by AWS on Kinesis.
Is there a way to convince Flink to just use 1 Consumer and pipe all of that data to all tasks?Vjeran Crnjak
03/18/2024, 11:47 AMAleksandr Pilipenko
03/19/2024, 9:49 AMVjeran Crnjak
03/19/2024, 10:25 AMdef collect_outputs(table_env: StreamTableEnvironment, config: AppConfig) -> List[Table]:
toggles: List[Table] = []
# comp{1,2,3,4,5} are functions that return a Table and work only with table API
for fault in it.chain(
comp1( table_env, config.source),
comp2( table_env, config.source),
comp3(table_env, config.source),
comp4( table_env, config.source),
comp5( table_env, config.source),
):
toggle_ds = table_env.to_append_stream(fault, Types.ROW_NAMED(
['ts', 'id', 'kind', 'toggle'],
[Types.SQL_TIMESTAMP(), Types.STRING(), Types.BOOLEAN()]
))
toggle_ds = (
toggle_ds
.key_by(lambda x: (x.id, x.kind))
.flat_map(EmitOnlyOnChange(),
output_type=Types.ROW_NAMED(
['ts', 'id', 'kind', 'desc'],
[Types.SQL_TIMESTAMP(), Types.STRING(), Types.STRING(), Types.STRING()]))
)
toggles.append(table_env.from_data_stream(toggle_ds))
return toggles
Toggles are then added to the sink via add_insert on the statement_set.
I am sure that computations get split by this table/ds conversion. I can understand that to a certain extent, but I dislike the fact that each one has its own kinesis stream consumer.Vjeran Crnjak
03/27/2024, 5:10 PM