fastfreeze icon indicating copy to clipboard operation
fastfreeze copied to clipboard

Support for CRIU page server

Open SallyKAN opened this issue 1 year ago • 0 comments

Hi, fastfreeze is an amazing job! I am currently using fastfreeze to bootstrap the start-up of Java applications, however, I have found that during the restore process, the most time cost comes from writing images to files on disk (including uncompressing). For example, the total time of the restore process is 1.3 sec, but the I/O operation might take up 0.7 sec.

[ff.run] (0.038s) Application clock: 47.1s
[ff.run] (0.041s) Starting set_ns_last_pid server
[ff.run] (0.042s) + set_ns_last_pid /var/tmp/fastfreeze/run/set_ns_last_pid.sock
[ff.run] (0.142s) Continuing reading image in memory...
[ff.run] (0.706s) Uncompressed image size is 695 MiB, rate: 1022 MiB/s
[ff.run] (0.706s)   Shard 1: 158 MiB, rate: 233 MiB/s
[ff.run] (0.706s)   Shard 2: 182 MiB, rate: 268 MiB/s
[ff.run] (0.706s)   Shard 3: 184 MiB, rate: 271 MiB/s
[ff.run] (0.706s)   Shard 4: 170 MiB, rate: 250 MiB/s
[ff.run] (1.272s) criu> (00.563271) Running pre-resume scripts
[ff.run] (1.272s) criu> (00.563505) Restore finished successfully. Tasks resumed.
[ff.run] (1.272s) criu> (00.563512) Writing stats
[ff.run] (1.272s) criu> (00.563610) Dismissing the image streamer
[ff.run] (1.272s) criu> (00.563657) Running post-resume scripts
[ff.run] (1.273s) Application is ready, restore took 1.3s

Since fastfreeze uses CRIU as the core engine, I noticed there is a page server option in CRIU to optimize the memory transfer process, but it only supports transferring page images on the fly. Considering fastfreeze would compress all the images generated by criu-image-streamer, I am wondering if fastfreeze supports CRIU page server function?

Also, I searched the source code of fastfreeze, there is an option called tcp_listen_remap which is not mentioned in the README doc now, could it be used to optimize the memory transfer process?

 let Self {
                image_url, app_args, on_app_ready_cmd, no_restore,
                allow_bad_image_version, passphrase_file, preserved_paths,
                tcp_listen_remap, leave_stopped, verbose: _, app_name,
                no_container } = self;

Thanks in advance!

SallyKAN avatar Nov 01 '22 12:11 SallyKAN