npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@peer-ring/kv-store

v1.1.0

Published

distributed,decentralized,embeddable in memory key value store with key level tunable consistency built on top of peer ring

Downloads

13

Readme

@peer-ring/kv-store

@peer-ring/kv-store: a distributed, decentralized, and embeddable in-memory key-value store crafted to seamlessly integrate with your applications. Tailor consistency per key to balance performance and reliability.

Why Consider @peer-ring/kv-store?

Ever needed a fast in-memory store for your applications, but faced challenges with synchronization across replicas (e.g., in Kubernetes)? Traditional solutions like Redis can bring complexity and additional management overhead.

@peer-ring/kv-store offers a simpler path. Embed it directly into your application to maintain consistent access to cached data across all replicas. Whether you're scaling up or down, your data stays safe and accessible, with optional replication for added peace of mind.

How It Works

Fueled by @peer-ring/core, @peer-ring/kv-store uses consistent hashing to distribute data efficiently. Writes are spread across replicas, ensuring resilience without compromising speed.

@peer-ring/kv-store currently only supports only k8s based peer discovery, which means you can only use it if you are running your apps on kubernetes.

No Image

Where It Fits

  • Between Embedded Caching and Hosted Solutions: It bridges the gap, providing the ease of in-memory caching with distributed system reliability.
  • An Alternative, Not a Replacement: While not displacing solutions like Redis, it offers a cost-effective choice where simpler management and lower costs meet your data storage needs.

How to use

  1. install
npm i @peer-ring/kv-store`
  1. Use it like a normal kv store.
import { KVStore } from "@peer-ring/kv-store";

const watchQueryParams = { labelSelector: `app=your-awesome-app` };
const kv = new KVStore({
  peerRingOpts: {
    peerDiscovery: {
      watchQueryParams,
    },
    netManager: {
      port: 4445, //grpc port used by @peer-ring/core for all p2p communication
    },
  },
  logger: {
    level: "warn", //pino logger options
  },
});

await kv.init();

await kv.set("name", "peer-ring", { ttl: 1000 });
const name = await kv.get<string>("name");
console.log(name);
await kv.delete("name");

generated types for peerRingOpts can be found here

Notes:

  1. @peer-ring/core is still under development_, you can use it as long as you are not bothered about durability of cached data. read here to understand how to choose the best quorum for your application.
  2. Currently Kv-store only works on top of k8s, other peer-discovery mechanisms are WIP.
  3. make sure that the application running on k8s has "get", "watch", "list" permission to listen to pod changes.
  4. data resides inside the pod(sharded across the replicas), so pod's memory is the limit of amount of data you can store.
  5. if possible run kv-store as a sidecar container for better separation from application(no out of the box solution yet, however its as simple as running another container with a REST server, check e2e for inspiration)

Make sure to check the features/limitations here