lzh9 created FLINK-11213:
----------------------------

             Summary: Is there any condition that large amount of redis 
connection created on each TM?
                 Key: FLINK-11213
                 URL: https://issues.apache.org/jira/browse/FLINK-11213
             Project: Flink
          Issue Type: Task
            Reporter: lzh9


In the job, large amount of redis connections are created on each TM, is there 
some ideas? code like:

def main(args:Array[String]): Unit = {
 val env = StreamExecutionEnvironment.getExecutionEnvironment
 env.addSource(new Source).setParallelism(4).addSink(new 
Sinker).setParallelism(4)
 env.execute()
}

class Sinker extends RichSinkFunction[String]{


 lazy val applicationContext = new 
ClassPathXmlApplicationContext("application-redis-context.xml")
 lazy val redisTemplate =applicationContext.getBean("redisTemplate", 
classOf[RedisTemplate[String, String]])

 override def invoke(value: String, context: SinkFunction.Context[_]): Unit = {
 val value = redisTemplate.opsForValue().get("key01")
 println(value)
 }
}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to