|
1 | 1 | This is demo code to show how to use CRIU (Checkpoint Restore In Userspace) from Java.
|
2 | 2 |
|
3 | 3 | It's very much a prototype. There are many caveats in this file. Please try it and let me know how it goes.
|
4 |
| - |
5 | 4 |
|
6 |
| -Make sure criu is running from the directory that has the socket file. |
7 |
| -[cflood@cflood FromInsideJava]$ sudo /home/cflood/criu/criu-latest/criu/criu service |
| 5 | +1) Make sure CRIU is enabled in your kernel |
| 6 | +sudo grep CHECKPOINT /boot/config-* |
| 7 | + |
| 8 | +2) Make sure you are running criu version 3.11 or higher |
| 9 | + |
| 10 | +3) Make sure criu service is running (socket create) in the same directory as your socket file. |
| 11 | +sudo criu service& |
8 | 12 | Warn (criu/cr-service.c:1160): Binding to local dir address!
|
9 | 13 |
|
10 |
| -Make sure kernel is compiled with CR turned on |
11 |
| -sudo grep CHECKPOINT /boot/config-* |
| 14 | +4) One last check |
| 15 | +sudo criu check |
12 | 16 |
|
| 17 | +5) Compile the java file |
13 | 18 | javac CheckpointRestore.java
|
14 | 19 |
|
| 20 | +6) Generate the .h file |
15 | 21 | javah CheckpointRestore
|
16 | 22 |
|
| 23 | +7) Make it into a .hpp file |
17 | 24 | mv CheckpointRestore.h CheckpointRestore.hpp
|
18 | 25 |
|
19 |
| -Make sure criu is installed and libcriu is on your library path. I set mine via |
| 26 | +8) Make sure criu is installed and libcriu is on your library path. I set mine via |
20 | 27 | export LOAD_LIBRARY_PATH=/usr/lib64:./
|
21 | 28 | There is probably a better way
|
22 | 29 |
|
23 |
| -Build the criu library. |
| 30 | +9) Build the criu library. |
24 | 31 | gcc -shared -fPIC -I/usr/lib/jvm/java-openjdk/include -I/usr/lib/jvm/java-openjdk/include/linux -I/usr/lib64/ -I/usr/include/criu -lcriu -o libCheckpointRestore.so CheckpointRestore.cpp
|
25 | 32 |
|
26 |
| -There is currently a problem with a socket file which is causing tests to fail. The short term fix is to delete this file. |
27 |
| -I did rm -rf rm -f /var/lib/sss/pipes/nss |
28 |
| -I'm working on addressing this problem. |
29 |
| - |
30 |
| -You can now checkpoint java code: |
| 33 | +10) You can now checkpoint java code: |
31 | 34 | sudo setsid java -XX:+UseSerialGC -XX:-UsePerfData -Djava.library.path=$LOAD_LIBRARY_PATH TestRandom 1000000 1000
|
32 | 35 |
|
33 |
| -This will print out the restore instructions which you can run as root: |
| 36 | +11) The command to restore will be printed during checkpointing. Mine was: |
34 | 37 |
|
35 | 38 | sudo java -XX:+UseSerialGC -XX:-UsePerfData -Djava.library.path=$LOAD_LIBRARY_PATH TestRandomRestore <saved world directory>
|
36 | 39 |
|
| 40 | + |
| 41 | +Known Issues: |
| 42 | + |
| 43 | +There is currently a problem with a socket file which is causing tests to fail. The short term fix is to delete this file. |
| 44 | +I did rm -rf rm -f /var/lib/sss/pipes/nss |
| 45 | +I'm working on addressing this problem. |
| 46 | + |
| 47 | +Saving Performance Data causes the generation of open files which can't be closed. |
| 48 | + |
| 49 | +ParallelGC causes an issue. |
0 commit comments