there is any benchmark of java flink vs pyflink?
# pyflink
u
there is any benchmark of java flink vs pyflink?
d
There were some basic benchmarks reported several years back comparing the two PyFlink runtimes (PROCESS vs THREAD modes) with the Java runtime. But I don't remember it being very thorough.
@Dian Fu and @Xingbo Huang worked on these. It was for their work on Pemja and threaded IIRC
u
Ok i have a kafka source of 50mb per second, and i have there heavy state (300gb) and windowing etc, would you suggest pyflink over java flink?
?
a
PyFlink in the end is mostly delegating to Java anyway via the java gateway. If you use PyFlink for that throughput you will have serialization overhead from Python to Java types. Do you need UDFs? Because that will add additional overhead.
u
My pyflink job is built from process functions in pyflink (i assume that its udf…) Its a pyflink job that reads from kafka of 50mb per second and the pyflink have windowing, state etc
d
@מייקי בר יעקב Hey, there are the following differences between PyFlink and the Java Flink regarding to state: • Java over Python: there is state serialization & communication overhead between the Java & Python process • Python over Java: there is state cache(LRU Cache) in the Python process which could avoid serialization/deserialization state for each state access. This could be seen as a cache layer between the operators and the state backend.
u
Thanks I have a simple pyflink code that reads from kafka, do some state processing and then perform thumbling window of 20 seconds. For some reason the window becomes a bottlenack and cause high CPU and busy for the job - can anyone explain why and how to solve it? I am using process mode (because thread mode doesnt works well with more then 1 slot per TM) with pyflink 1.20
there is best practice way to read from kafka into a python class in pyflink? Currently I read it as datastream of string and then using json.dumps or rejoin.loads deserialize into my python class