{"id":18930169,"url":"https://github.com/nheidloff/openwhisk-memory-java-javascript","last_synced_at":"2026-03-16T19:30:16.582Z","repository":{"id":88375211,"uuid":"175783282","full_name":"nheidloff/openwhisk-memory-java-javascript","owner":"nheidloff","description":"Memory Usage of OpenWhisk Functions with Java and JavaScript","archived":false,"fork":false,"pushed_at":"2019-03-15T08:56:04.000Z","size":271,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-31T19:30:10.043Z","etag":null,"topics":["java","javascript","memory","openwhisk","serverless"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/nheidloff.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-15T08:52:59.000Z","updated_at":"2019-03-15T09:04:31.000Z","dependencies_parsed_at":"2024-03-30T16:00:58.962Z","dependency_job_id":null,"html_url":"https://github.com/nheidloff/openwhisk-memory-java-javascript","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nheidloff%2Fopenwhisk-memory-java-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nheidloff%2Fopenwhisk-memory-java-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nheidloff%2Fopenwhisk-memory-java-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nheidloff%2Fopenwhisk-memory-java-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nheidloff","download_url":"https://codeload.github.com/nheidloff/openwhisk-memory-java-javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239927825,"owners_count":19719835,"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":["java","javascript","memory","openwhisk","serverless"],"created_at":"2024-11-08T11:36:49.372Z","updated_at":"2026-03-16T19:30:16.536Z","avatar_url":"https://github.com/nheidloff.png","language":"JavaScript","readme":"# OpenWhisk Functions with Java and JavaScript\n\nIn the cloud you typically pay by the amount of memory your code needs and how long the code runs. This project contains a little experiment to compare how much memory functions require which run on [Apache OpenWhisk](https://openwhisk.apache.org/) and have been implemented with Java and JavaScript.\n\nThere are five different types of functions:\n\n* JavaScript functions as OpenWhisk provides them out of the box\n* Java functions as OpenWhisk provides them out of the box\n* Java functions using [Quarkus](https://quarkus.io/)\n* JavaScript functions using node:8-alpine\n* Java functions using a classic JavaEE stack\n\n*Note:* This is just a quick experiment. Draw your own conclusions.\n\n\n## Prerequisites\n\nGet a free [IBM Cloud Lite](https://ibm.biz/nheidloff) account.\n\nMake sure you have the following prerequisites installed:\n\n* [ibmcloud](https://console.bluemix.net/docs/openwhisk/bluemix_cli.html#cloudfunctions_cli) CLI and ibmcloud fn plugin\n* [node](https://nodejs.org/en/download/)\n\nFollow the [instructions](https://quarkus.io/guides/building-native-image-guide) on the Quarkus web site how to set up GraalVM, a Java JDK and Maven.\n\nLogin to the IBM Cloud and Docker Hub:\n\n```\n$ ibmcloud login\n$ docker login\n```\n\n\n## Build and run Functions on IBM Cloud Functions\n\n\n**Node.js OpenWhisk Functions**\n\n```\n$ scripts/create-function-nodejs-openwhisk.sh\n$ node scripts/invoke-function-nodejs-openwhisk.js\n$ scripts/delete-function-nodejs-openwhisk.sh\n```\n\n\n**Java OpenWhisk Functions**\n\n```\n$ mvn -f java-openwhisk/pom.xml package\n$ scripts/create-function-java-openwhisk.sh\n$ node scripts/invoke-function-java-openwhisk.js\n$ scripts/delete-function-java-openwhisk.sh\n```\n\n\n**Node.js Alpine Functions**\n\nUse your Docker name instead of 'nheidloff'.\n\n```\n$ docker build -f ./nodejs-alpine/Dockerfile -t nheidloff/echo-nodejs-alpine:1 .\n$ docker push nheidloff/echo-nodejs-alpine:1\n$ scripts/create-function-nodejs-alpine.sh\n$ node scripts/invoke-function-nodejs-alpine.js\n$ scripts/delete-function-nodejs-alpine.sh\n```\n\n\n**Java Quarkus Functions**\n\nUse your Docker name instead of 'nheidloff'.\n\n```\n$ mvn package -f ./java-quarkus/pom.xml -Pnative -Dnative-image.docker-build=true\n$ docker build -f ./java-quarkus/Dockerfile -t nheidloff/echo-java-quarkus:1 .\n$ docker push nheidloff/echo-java-quarkus:1\n$ scripts/create-function-java-quarkus.sh\n$ node scripts/invoke-function-java-quarkus.js\n$ scripts/delete-function-java-quarkus.sh\n```\n\n\n**Java JEE Functions**\n\nUse your Docker name instead of 'nheidloff'.\n\n```\n$ mvn package -f ./java-jee/pom.xml \n$ docker build -f ./java-jee/Dockerfile -t nheidloff/echo-java-jee:1 .\n$ docker push nheidloff/echo-java-jee:1\n$ scripts/create-function-java-jee.sh\n$ node scripts/invoke-function-java-jee.js\n$ scripts/delete-function-java-jee.sh\n```\n\n\n## Run Functions locally in Docker\n\n\n**Node.js Alpine Functions**\n\n```\n$ docker run -i --rm -p 8081:8081 -m 128MB --name echo-nodejs-alpine nheidloff/echo-nodejs-alpine:1\n$ curl --request POST \\\n  --url http://localhost:8081/run \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"value\":{\"name\":\"Niklas\"}}'\n```\n\n\n**Java Quarkus Functions**\n\n```\n$ docker run -i --rm -p 8080:8080 -m 128MB --name echo-java-quarkus nheidloff/echo-java-quarkus:1\n$ curl --request POST \\\n  --url http://localhost:8080/run \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"value\":{\"name\":\"Niklas\"}}'\n```\n\n\n**Java JEE Functions**\n\n```\n$ docker run -i --rm -p 9080:9080 --name echo-java-quarkus nheidloff/echo-java-jee:1\n$ curl --request POST \\\n  --url http://localhost:9080/run \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"value\":{\"name\":\"Niklas\"}}'\n```\n\n\n## Run Functions locally in OpenWhisk\n\nFollow the [instructions](https://github.com/apache/incubator-openwhisk-devtools/blob/master/docker-compose/README.md) to set up OpenWhisk locally.\n\nBuild the images as described above.\n\nOnce OpenWhisk is running locally, invoke these commands to create the functions.\n\n```\n$ scripts-local/create-function-nodejs-openwhisk.sh\n$ scripts-local/create-function-nodejs-alpine.sh\n$ scripts-local/create-function-java-openwhisk.sh\n$ scripts-local/create-function-java-quarkus.sh\n```\n\nTo generate some workload, run this command:\n\n```\n$ node scripts-local/create-load.js\n```\n\nIn a separate terminal run this command:\n\n```\n$ docker stats\n```\n\n\u003ckbd\u003e\u003cimg src=\"docker-stats.png\" /\u003e\u003c/kbd\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnheidloff%2Fopenwhisk-memory-java-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnheidloff%2Fopenwhisk-memory-java-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnheidloff%2Fopenwhisk-memory-java-javascript/lists"}