Snappy-start: Tool for launching a Linux process from a snapshot
github.com
github.com
[1] http://www.sysproject.info/condor.php
[2] http://research.cs.wisc.edu/htcondor/doc/condor-practice.pdf
This approach comes in two flavors - in one, each transaction gets a fresh copy of the program. In the other, the program is used over and over unless it aborts, in which case a new clean copy is loaded and used. This corresponds to CGI and FCGI under Apache.
Programs which run as transactions have to be prepared for some unusual events. Time, for example, suddenly jumps forward when a stored transaction program starts. File and network connections have to be connected to the right things. Stateful connections, as with databases, may not play well with this approach. This can work well when the program doesn't have that much live state when the transaction program is frozen. A program that has a lot of startup overhead related to getting external resources may not be a good candidate. Unfortunately, those are the ones for which this is the biggest win.
If the main program is program loading overhead, as in Python and Java, maybe the solution is to go hard-compiled. C, C++, Go, and Rust are hard-compiled, and you can even hard-compile Java with GCC. Python and Javascript don't have that option.
(Nightmare of the future - precompiled Javascript snapshot blobs loaded into browsers.)
I would think you'd need rather robust error handling in the program being snapshotted: there would be several machine states which would change from run to run.
Snapshots becomes much more powerful when combined with a transactional log of all changes. This gets around certain problems with de-synchronization of source files with the image. Smalltalks that abandoned the change-log and returned to conventional source files suffered for it. (Enfin/ObjectStudio)
Hello, world!
Hello, world!
* Running test: ./out/example_loader
Traceback (most recent call last):
File "tests/run_tests.py", line 57, in <module>
Main()
File "tests/run_tests.py", line 40, in Main
RunTest(['./out/example_loader'], -1, use_elf_loader=False)
File "tests/run_tests.py", line 34, in RunTest
subprocess.check_call(['./out/restore'])
File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['./out/restore']' returned non-zero exit status -11
Interestingly the project has Github issues disabled.This is pretty weird. Certainly goes against the spirit of free software in my book. It's not like they have to answer any issues.
(Oh right it's Google. Well that explains that.)
Descriptions of how checkpointing works: https://en.wikipedia.org/wiki/Application_checkpointing http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.117... http://www.anchor.com.au/blog/2013/02/overview-of-checkpoint... https://lwn.net/Articles/478111/ https://www.usenix.org/legacy/event/usenix01/freenix01/full_...
Individual solutions: https://ckpt.wiki.kernel.org/index.php/Main_Page https://code.google.com/p/cryopid/ http://criu.org/Main_Page http://crd.lbl.gov/departments/computer-science/CLaSS/resear...
An almost-full list of solutions here: http://checkpointing.org/
Yes, exactly like smalltalk. sigh.
Here's a fun example of it in action: http://blog.kubernetes.io/2015/07/how-did-quake-demo-from-do...
Since the README mentions kentonv, I wonder if this would be useful within Sandstorm.
If you want to do syscall replaying, check out the Approximate Replay-Trace Compiler (ARTC).
For a full checkpointing suite on modern Linux, see CRIU or DMTCP.
Trace while running, take a snapshot when there's something wrong
Reminds me of a Lisp image dump.
Thoughts?
if this works on a single program, what sort of use cases would this come in handy? Perhaps a java program that has a bit of startup time?