Hi Miyuru,
Indeed, the behaviour you observed sounds strange and kind of go against
the results Stefan presented in [1]. To see what is going on, can you
also share your changes to Flink's configuration, i.e. flink-conf.yaml?

Let's first make sure you're really comparing RocksDBStateBackend with
vs without incremental checkpoints:
- if you remove this from the code:
    env.setStateBackend(new RocksDBStateBackend(
           new FsStateBackend("file:///home/ubuntu/tmp-flink-rocksdb"),
           true));
then you will end up with the state backend configured via the
"state.backend" property. Was this set to "rocksdb"? Alternatively, you
can set the second parameter to the RocksDBStateBackend constructor to
false to get the right back-end.

You can also verify the values you see from the web interface by looking
into the logs (at INFO level). There, you should see reports like this:
"Asynchronous RocksDB snapshot (..., asynchronous part) in thread ...
took ... ms." and "Asynchronous RocksDB snapshot (..., synchronous part)
in thread ... took ... ms."

Other than that, from what I know about it (Stefan (cc'd), correct me if
I'm wrong), incremental checkpoints only do hard links locally to the
changed sst files and then copy the data in there to the checkpoint
store (the path you gave). A full checkpoint must copy all current data.
If, between two checkpoints, you write more data than the contents of
the database, e.g. by updating a key multiple times, you may indeed have
more data to store. Judging from the state sizes you gave, this is
probably not the case.


Let's get started with this and see whether there is anything unusual.


Regards,
Nico


[1]
https://berlin.flink-forward.org/kb_sessions/a-look-at-flinks-internal-data-structures-and-algorithms-for-efficient-checkpointing/

On 19/03/18 05:25, Miyuru Dayarathna wrote:
> Hi,
> 
> We did a performance test of Flink's incremental checkpointing to
> measure the average time it takes to create a checkpoint and the average
> checkpoint file size. We did this test on a single computer in order to
> avoid the latencies introduced by network communication. The computer
> had Intel® Core™ i7-7600U CPU @ 2.80GHz, 4 cores, 16GB RAM, 450GB HDD,
> 101GB free SSD space. The computer was running on Ubuntu 16.04
> LTS, Apache Flink 1.4.1, Java version "1.8.0_152", Java(TM) SE Runtime
> Environment (build 1.8.0_152-b16), Java HotSpot(TM) 64-Bit Server VM
> (build 25.152-b16, mixed mode). We used the JVM flags -Xmx8g -Xms8g. The
> test was run for 40 minutes.
> 
> The Flink application we used is as follows,
> //---------------------------------------------------------------------------------------------------------
> public class LengthWindowIncrementalCheckpointing {
>     private static DataStream<Tuple4<String, Float, Integer, String>>
> inputStream = null;
>     private static final int PARALLELISM = 1;
>     private static final int timeoutMillis = 10;
>     private static final int WINDOWLENGTH = 10000;
>     private static final int SLIDELENGTH = 1;
>     private static Logger logger =
> LoggerFactory.getLogger(LengthWindowIncrementalCheckpointing.class);
> 
>     public static void main(String[] args) {
>         StreamExecutionEnvironment env =
> StreamExecutionEnvironment.getExecutionEnvironment();
> 
>         // start a checkpoint every 1000 ms
>         env.enableCheckpointing(1000);
>         try {
>             env.setStateBackend(new RocksDBStateBackend(
>                     new
> FsStateBackend("file:///home/ubuntu/tmp-flink-rocksdb"),
>                     true));
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
> 
>         env.setBufferTimeout(timeoutMillis);
>         inputStream = env.addSource(new
> MicrobenchSourceFunction()).setParallelism(PARALLELISM).name("inputStream");
> 
>         DataStream<Tuple4<String, Float, Integer, String>>
> incrementStream2 =
>                 inputStream.filter(new FilterFunction<Tuple4<String,
> Float, Integer, String>>() {
>                     @Override
>                     public boolean filter(Tuple4<String, Float, Integer,
> String> tuple) throws Exception {
>                         if (tuple.f1 > 10) {
>                             return true;
>                         }
>                         return false;
>                     }
>                 }).keyBy(1).countWindow(WINDOWLENGTH, SLIDELENGTH).sum(2);
>         incrementStream2.writeUsingOutputFormat(new
> DiscardingOutputFormat<Tuple4<String, Float, Integer,
>                 String>>());
> 
>         try {
>             env.execute("Flink application.");
>         } catch (Exception e) {
>             logger.error("Error in starting the Flink stream
> application: " + e.getMessage(), e);
>         }
>     }
> }
> 
> //---------------------------------------------------------------------------------------------------------
> 
> I have attached two charts (Average_latencies.jpg and
> Average_state_sizes.jpg) with the results and another image with the
> Flink dashboard (Flink-Dashboard.png). The average state size chart
> indicates that the size of an incremental checkpoint is smaller than a
> full (i.e., complete) checkpoint. This is the expected behavior from any
> incremental checkpointing system since the incremental checkpoint just
> stores the delta change. However, the average latency chart indicates
> that the average latency for taking an incremental checkpoint from Flink
> is larger than taking a complete (i.e., Full) checkpoint. Is this the
> expected behavior? I have highlighted the two fields in the
> "Flink-Dashboard.png" which we used as the fields for the average
> latency and the average state size. Note that to convert the incremental
> checkpointing application to full checkpointing application we just
> commented out the following lines in the above code.
> 
>         try {
>             env.setStateBackend(new RocksDBStateBackend(
>                     new
> FsStateBackend("file:///home/ubuntu/tmp-flink-rocksdb"),
>                     true));
>         } catch (IOException e) {
>             e.printStackTrace();
>         }
> 
> Thanks,
> Miyuru

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to