I currently have a Paralellism=1 setup for Flink. ...
# troubleshooting
v
I currently have a Paralellism=1 setup for Flink. I wrote a bunch of computations on 1 source and this is how the Job/Task/Sub-tasks look (image in the thread). The issue I'm having is that
GetRecords
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?
a
Hi, could you share a snippet of how you currently construct your job?
v
Copy code
def 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.
This became a significant problem. The kinesis stream is just bombed with GetRecords queries even though we only have 1 machine active and barely any data going through.