In stream application how many times the map transformation object being created?
Say I have directKafkaStream.repartition(numPartitions).mapPartitions (new FlatMapFunction_derivedclass(configs)); class FlatMapFunction_derivedclass{ FlatMapFunction_derivedclass(Config config){ } @Override public Iterable<String> call(Iterator<byte[][]> t) throws Exception {..} } How many times FlatMapFunction_derivedclass will be instantiated ? 1.Will the constructor of this class be called only once and same object is serialised and transferred to executors at each batch interval and deserialized at each batch interval on executors.So if my stream application has run 400 batches, same object has been deserialised 400 times ? 2.So I should avoid creating external connection object say http connection in constrcuor of FlatMapFunction_derivedclass rather it should only be created in call function always and will be craeted at each batch interval ?