{"id":26121700,"url":"https://github.com/fizzed/shmemj","last_synced_at":"2026-05-27T18:32:48.516Z","repository":{"id":203610367,"uuid":"702785343","full_name":"fizzed/shmemj","owner":"fizzed","description":"Shared memory and Interprocess Communication (IPC) Library for Java","archived":false,"fork":false,"pushed_at":"2023-11-30T00:27:45.000Z","size":8603,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T14:25:23.647Z","etag":null,"topics":["ipc","java","shared-memory","shmem"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fizzed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-10T02:34:16.000Z","updated_at":"2025-01-14T01:23:36.000Z","dependencies_parsed_at":"2023-11-30T01:41:40.744Z","dependency_job_id":null,"html_url":"https://github.com/fizzed/shmemj","commit_stats":null,"previous_names":["fizzed/shmemj"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/fizzed/shmemj","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fizzed%2Fshmemj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fizzed%2Fshmemj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fizzed%2Fshmemj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fizzed%2Fshmemj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fizzed","download_url":"https://codeload.github.com/fizzed/shmemj/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fizzed%2Fshmemj/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33579665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ipc","java","shared-memory","shmem"],"created_at":"2025-03-10T14:24:45.131Z","updated_at":"2026-05-27T18:32:48.499Z","avatar_url":"https://github.com/fizzed.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shmemj (Shared Memory for Java) by Fizzed\n\n[![Maven Central](https://img.shields.io/maven-central/v/com.fizzed/shmemj?color=blue\u0026style=flat-square)](https://mvnrepository.com/artifact/com.fizzed/shmemj)\n\n[![Java 11](https://img.shields.io/github/actions/workflow/status/fizzed/shmemj/java11.yaml?branch=master\u0026label=Java%2011\u0026style=flat-square)](https://github.com/fizzed/shmemj/actions/workflows/java11.yaml)\n[![Java 17](https://img.shields.io/github/actions/workflow/status/fizzed/shmemj/java17.yaml?branch=master\u0026label=Java%2017\u0026style=flat-square)](https://github.com/fizzed/shmemj/actions/workflows/java17.yaml)\n[![Java 19](https://img.shields.io/github/actions/workflow/status/fizzed/shmemj/java21.yaml?branch=master\u0026label=Java%2021\u0026style=flat-square)](https://github.com/fizzed/shmemj/actions/workflows/java21.yaml)\n\n## Overview\n\nAccess and use shared memory from the host operating system in Java 11+ on a wide variety of operating systems. Extremely\nfast and efficient method of IPC (interprocess communication) between Java-to-Java processes or even Java-to-other \nprocesses written in different languages.\n\n - Lightweight wrappers around shared memory APIs in an OS agnostic way\n - Lightweight wrapper around OS synchronization primitives including conditions with lock and atomic variable implementations\n - Native binding for Java are written in Rust\n - Thorough unit tests along with automated testing across operating systems and versions\n - Sophisticated ```ShmemChannel``` which provides a socket-like interface for communicating between Java programs\n - Supports Java 11+ (could support earlier versions but this lib uses the new process id utilities added in Java 9)\n\n## Sponsorship \u0026 Support\n\n![](https://cdn.fizzed.com/github/fizzed-logo-100.png)\n\nProject by [Fizzed, Inc.](http://fizzed.com) (Follow on Twitter: [@fizzed_inc](http://twitter.com/fizzed_inc))\n\n**Developing and maintaining opensource projects requires significant time.** If you find this project useful or need\ncommercial support, we'd love to chat. Drop us an email at [ping@fizzed.com](mailto:ping@fizzed.com)\n\nProject sponsors may include the following benefits:\n\n- Priority support (outside of Github)\n- Feature development \u0026 roadmap\n- Priority bug fixes\n- Privately hosted continuous integration tests for their unique edge or use cases\n\n## Performance\n\n```ShmemChannel``` is up to 2-3x faster on linux compared to TCP/Unix Domain sockets, 5-6x faster on Windows, and\nalmost 9-10x faster on MacOS.\n\n## Usage\n\nAdd the following to your maven POM file for Linux x64\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.fizzed\u003c/groupId\u003e\n  \u003cartifactId\u003eshmemj-linux-x64\u003c/artifactId\u003e\n  \u003cversion\u003eVERSION-HERE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nOr MacOS arm64 (Apple silicon)\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.fizzed\u003c/groupId\u003e\n  \u003cartifactId\u003eshmemj-macos-arm64\u003c/artifactId\u003e\n  \u003cversion\u003eVERSION-HERE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nOr for all operating system \u0026 arches\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.fizzed\u003c/groupId\u003e\n  \u003cartifactId\u003eshmemj-all-natives\u003c/artifactId\u003e\n  \u003cversion\u003eVERSION-HERE\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nTo simplify versions, you may optionally want to import our BOM (bill of materials)\n\n```xml\n\u003cdependencyManagement\u003e\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.fizzed\u003c/groupId\u003e\n            \u003cartifactId\u003eshmemj-bom\u003c/artifactId\u003e\n            \u003cversion\u003eVERSION-HERE\u003c/version\u003e\n            \u003cscope\u003eimport\u003c/scope\u003e\n            \u003ctype\u003epom\u003c/type\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/dependencyManagement\u003e\n```\n\nThe easiest way to see this library in action is to peruse the various demos and benchmarks: https://github.com/fizzed/shmemj/tree/master/shmemj-integration-tests/src/main/java/com/fizzed/shmemj/demo\n\nTo use shared memory, use the factory to build one:\n\n```java\nimport com.fizzed.shmemj.Shmem;\nimport com.fizzed.shmemj.ShmemFactory;\n\n... other code\n\nShmem shmem = new ShmemFactory()\n    .setSize(2048L)\n    .create();\n\nByteBuffer buf = shmem.newByteBuffer(0, 30);\nbuf.putDouble(5.4d);\nbuf.putDouble(3.12345d);\nbuf.putDouble(3.12345d);\n```\n\nTo use the shared memory channel (a socket-like class):\n\n```java\npackage com.fizzed.shmemj.demo;\n\nimport com.fizzed.shmemj.*;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport java.nio.channels.ClosedChannelException;\nimport java.nio.file.Path;\nimport java.util.concurrent.TimeUnit;\n\nimport static com.fizzed.shmemj.demo.DemoHelper.*;\n\npublic class ShmemChannelServerDemo {\n    static private final Logger log = LoggerFactory.getLogger(ShmemChannelServerDemo.class);\n\n    static public void main(String[] args) throws Exception {\n        final Path address = temporaryFile(\"shmem_channel_demo.sock\");\n\n        try (final ShmemServerChannel channel = new ShmemChannelFactory().setSize(4096L).setAddress(address).setSpinLocks(true).createServerChannel()) {\n            for (;;) {\n                log.info(\"Listening on channel {} (as pid {})\", channel.getAddress(), ProcessProvider.DEFAULT.getCurrentPid());\n\n                try (final ShmemChannelConnection conn = channel.accept(120, TimeUnit.SECONDS)) {\n\n                    log.info(\"Connected with process pid={}\", conn.getRemotePid());\n\n                    for (;;) {\n                        // recv request\n                        String req;\n                        try (ShmemChannel.Read read = conn.read(5, TimeUnit.SECONDS)) {\n                            req = getStringUTF8(read.getBuffer());\n                            log.debug(\"Received: {}\", req);\n                        }\n\n                        // send response\n                        try (ShmemChannel.Write write = conn.write(5, TimeUnit.SECONDS)) {\n                            String resp = req + \" World!\";\n                            putStringUTF8(write.getBuffer(), resp);\n                            log.debug(\"Sending: {}\", resp);\n                        }\n                    }\n                } catch (ShmemClosedConnectionException e) {\n                    log.info(\"Closed connection {}: error={}\", channel.getAddress(), e.getMessage());\n                }\n            }\n        } catch (ShmemDestroyedException e) {\n            log.info(\"Destroyed channel {}\", address);\n        }\n\n        log.info(\"Done. Exiting.\");\n    }\n\n}\n```\n\n## Native Libs\n\n| Platform | Artifact | Notes |\n| :--------------- | :----------- | :---- |\n| freebsd x64 | shmemj-freebsd-x64 | freebsd 12+ |\n| linux arm64 | shmemj-linux-arm64 | built on ubuntu 16.04, glibc 2.23+ |\n| linux armel | shmemj-linux-armel | built on ubuntu 16.04, glibc 2.23+ |\n| linux armhf | shmemj-linux-armhf | built on ubuntu 16.04, glibc 2.23+ |\n| linux riscv64 | shmemj-linux-riscv64 | built on ubuntu 18.04, glibc 2.31+ |\n| linux x32 | shmemj-linux-x32 | built on ubuntu 16.04, glibc 2.23+ |\n| linux x64 | shmemj-linux-x64 | built on ubuntu 16.04, glibc 2.23+ |\n| linux_musl x64 | shmemj-linux_musl-x64 | alpine 3.11+ |\n| macos arm64 | shmemj-macos-arm64 | macos 11+ |\n| macos x64 | shmemj-macos-x64 | macos 10.13+ |\n| windows arm64 | shmemj-windows-arm64 | win 10+ |\n| windows x32 | shmemj-windows-x32 | win 7+ |\n| windows x64 | shmemj-windows-x64 | win 7+ |\n\n## Development\n\nWe leverage Rust for the native implementation.  If you need to hack on the Rust code, install the rust toolchain along\nwith cargo.\n\n    java -jar blaze.jar build_natives\n\nTo run tests\n\n    mvn test\n\n### Cross Building\n\nWe use a simple, yet quite sophisticated build system for fast, local builds across operating system and architectures.\n\nFor linux targets, we leverage docker containers either running locally on an x86_64 host, or remotely on dedicated\nbuild machines running on arm64, macos x64, and macos arm64.\n\nTo build containers, you'll want to edit setup/blaze.java and comment out/edit which platforms you'd like to build for,\nor potentially change them running on a remote machine via SSH.  Once you're happy with what you want to build for:\n\n     java -jar blaze.jar cross_build_containers\n     java -jar blaze.jar cross_build_natives\n     java -jar blaze.jar cross_tests\n\nFor information on registering your x86_64 host to run other architectures (e.g. riscv64 or aarch64), please see\nthe readme for https://github.com/fizzed/buildx\n\nYou need to install the target for rust to compile with.  On windows:\n\n    rustup target add x86_64-pc-windows-msvc\n    rustup target add i686-pc-windows-msvc\n    rustup target add aarch64-pc-windows-msvc\n\nOn macos:\n\n    rustup target add x86_64-apple-darwin\n    rustup target add aarch64-apple-darwin\n\n## License\n\nCopyright (C) 2023 Fizzed, Inc.\n\nThis work is licensed under the Apache License, Version 2.0. See LICENSE for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffizzed%2Fshmemj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffizzed%2Fshmemj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffizzed%2Fshmemj/lists"}