{"id":19015335,"url":"https://github.com/hansolo/crac8","last_synced_at":"2025-07-25T04:08:21.374Z","repository":{"id":156125532,"uuid":"620313961","full_name":"HanSolo/crac8","owner":"HanSolo","description":"CRaC demo","archived":false,"fork":false,"pushed_at":"2023-11-16T09:47:24.000Z","size":4266,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T01:47:27.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HanSolo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-28T12:49:14.000Z","updated_at":"2024-04-26T15:50:10.000Z","dependencies_parsed_at":"2023-11-16T10:38:24.185Z","dependency_job_id":null,"html_url":"https://github.com/HanSolo/crac8","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HanSolo/crac8","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fcrac8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fcrac8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fcrac8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fcrac8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HanSolo","download_url":"https://codeload.github.com/HanSolo/crac8/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HanSolo%2Fcrac8/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261220241,"owners_count":23126718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T19:36:47.511Z","updated_at":"2025-06-22T01:33:40.231Z","avatar_url":"https://github.com/HanSolo.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Running the demo in a docker container (on a Linux x64/aarch64 machine)\n\n#### Description\nThe crac8 demo should emulate a service that needs to load around 258 000 names from a\njson file at startup. The \"service\" provides methods to create a number of random\nnames for either boys or girls. When started normally it will first load the data\nfrom the json file into datastructures and then will create 5 random names for girls\nand 5 random names for boys.\nThis will take around 1-2 sec depending on the machine you run it on.\nOnce you create a checkpoint and restore it from there, the response will only\ntake around 30-50 ms because the data was already loaded from the file and now\none can directly access it which leads to the fast \"startup\" time.\n\n\n#### Build the jar file on the target platform:\nTo create the jar file you need to build it on the target platform (Linux x64 or aarch64) using\nthe a JDK that supports CRaC. You can find builds here [Azul](https://www.azul.com/downloads/?version=java-17-lts\u0026os=linux\u0026package=jdk-crac#zulu).\n1. make sure you set JAVA_HOME to the JVM with CRaC support\n2. go the project folder\n3. run ```gradlew clean build```\n4. Now you should find the the jar at ```build/libs/crac8-17.0.0-fat.jar```\n5. This jar file will later be used to run on the docker container\n6. Make sure to select the correct JDK in the docker file (x64 or aarch64)\n\n\n#### Login into docker:\n```docker login```\n\n\n#### Build docker image:\n```docker build -t crac8 .```\n\n\n#### Commit image to dockerhub:\n```docker commit crac8```\n\n\n#### Run docker image without checkpoint:\n```docker run -it --privileged --rm --name crac8 hansolo/crac8 java -XX:CRaCCheckpointTo=/opt/crac-files -jar /opt/app/crac8-17.0.0.jar```\n\n\n#### Run docker image with checkpoint:\n```docker run -it --privileged --rm --name $1 hansolo/crac8:checkpoint java -XX:CRaCRestoreFrom=/opt/crac-files```\n\n\n#### 1. Start the application in a docker container\n1. Open a shell window\n2. Run ``` docker run -it --privileged --rm --name crac8 crac8 ```\n3. In the docker container run\u003c/br\u003e\n```\ncd /opt/app\njava -XX:CRaCCheckpointTo=/opt/crac-files -jar crac8-17.0.0.jar keeprunning\n```\n\n\u003c/br\u003e\n\n#### 2. Start a 2nd shell window and create the checkpoint\n1. Open a second shell window\n2. Run ``` docker exec -it -u root crac8 /bin/bash ```\n3. Execute ``` top ``` command and note the PID of the running java process\n4. Take the PID and run ``` jcmd PID JDK.checkpoint```\n5. In the first shell window the application should have created the checkpoint\n6. Check the folder /opt/crac-files for the checkpoint files being present\n7. In second shell window run ``` exit ``` to get back to your machine\n\n\u003c/br\u003e\n\n#### 3. Commit the current state of the docker container\n1. Now get the CONTAINER_ID from shell window 1 by execute ``` docker ps -a ``` in shell window 2\n2. Exit the docker container in shell window 1 by executing ``` exit ```\n3. Run ``` docker commit CONTAINER_ID crac8:checkpoint ``` in shell window 2\n\n\u003c/br\u003e\n\n#### 4. Run the docker container from the saved state incl. the checkpoint\nNow you can start the docker container from the checkpoint by executing\n``` docker run -it --privileged --rm --name crac8 crac8:checkpoint java -XX:CRaCRestoreFrom=/opt/crac-files ```\n\n\u003c/br\u003e\n\n#### 5. Create a shell script to restore multiple times\n1. Open a shell window\n2. Create a text file named ```restore_crac8.sh```\n3. Add\n```\n#!/bin/bash\n\necho \"docker run -it --privileged --rm --name $1 crac8:checkpoint java -XX:CRaCRestoreFrom=/opt/crac-files\"\n\ndocker run -it --privileged --rm --name $1 crac8:checkpoint java -XX:CRaCRestoreFrom=/opt/crac-files\n```\n4. Make the script executable by executing ```chmod +x restore_crac8.sh```\n5. Now you can start the docker container multiple times executing ```restore_crac8.sh NAME_OF_CONTAINER```\n\nIf you would like to start the original container without the checkpoint you can still\ndo that by executing the following command\n```\ndocker run -it --privileged --rm --name crac8 crac8 java -jar /opt/app/crac8-17.0.0.jar\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansolo%2Fcrac8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhansolo%2Fcrac8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhansolo%2Fcrac8/lists"}