flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurt Young <ykt...@gmail.com>
Subject Re: the design of spilling to disk
Date Wed, 20 Sep 2017 01:09:30 GMT
Copied from my earlier response to some similar question:

"Here is a short description for how it works: there are totally 3 threads
working together, one for reading, one for sorting partial data in memory,
and the last one is responsible for spilling. Flink will first figure out
how many memory it can use during the in-memory sort, and manage them as
MemorySegments. Once these memory runs out, the sorting thread will take
over these memory and do the in-memory sorting (For more details about
in-memory sorting, you can see NormalizedKeySorter). After this, the
spilling thread will write this sorted data to disk and make these memory
available again for reading. This will repeated until all data has been
processed.
Normally, the data will be read twice (one from source, and one from disk)
and write once, but if you spilled too much files, flink will first merge
some all the files and make sure the last merge step will not exceed some
limit (default 128). Hope this can help you."

Best,
Kurt

On Wed, Sep 20, 2017 at 12:19 AM, Florin Dinu <florin.dinu@epfl.ch> wrote:

> Hi Kostas,
>
>
> Thank you for the quick reply and the tips. I will check them out !
>
>
> I would like to start by understanding the way secondary storage is used
> in batch processing.
>
> If you guys have additional pointers on that, it would certainly help me a
> lot.
>
>
> Thanks again,
>
> Florin
>
>
> ------------------------------
> *From:* Kostas Kloudas <k.kloudas@data-artisans.com>
> *Sent:* Tuesday, September 19, 2017 18:10
> *To:* Florin Dinu
> *Cc:* user@flink.apache.org; fhueske@apache.org
> *Subject:* Re: the design of spilling to disk
>
> Hi Florin,
>
> Unfortunately, there is no design document.
>
> The UnilateralSortMerger.java is used in the batch processing mode (not
> is streaming) and,
> in fact, the code dates some years back. I cc also Fabian as he may have
> more things to say on this.
>
> Now for the streaming side, Flink uses 3 state-backends, in-memory (no
> spilling and mainly useful for testing),
> filesystem and RocksDB (both eventually spill to disk but in different
> ways), and it also supports incremental
> checkpoints, i.e. at each checkpoint it only stores the diff between
> checkpoint[i] and checkpoint[i-1].
>
> For more information on Flink state and state backends, checkout the
> latest talk from Stefan Richter at
> Flink Forward Berlin 2017 (https://www.youtube.com/watch?v=dWQ24wERItM)
> and the .
>
> Cheers,
> Kostas
>
> On Sep 19, 2017, at 6:00 PM, Florin Dinu <florin.dinu@epfl.ch> wrote:
>
> Hello everyone,
>
> In our group at EPFL we're doing research on understanding and potentially
> improving the performance of data-parallel frameworks that use secondary
> storage.
> I was looking at the Flink code to understand how spilling to disk
> actually works.
> So far I got to the UnilateralSortMerger.java and its spill and reading
> threads. I also saw there are some spilling markers used.
> I am curious if there is any design document available on this topic.
> I was not able to find much online.
> If there is no such design document I would appreciate if someone could
> help me understand how these spilling markers are used.
> At a higher level, I am trying to understand how much data does Flink
> spill to disk after it has concluded that it needs to spill to disk.
>
> Thank you very much
> Florin Dinu
>
>
>

Mime
View raw message