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

@zingle/esbulker

v0.1.0-beta2

Published

Elasticsearch bulking proxy

Downloads

6

Readme

Build Status Coverage Status

esbulker Bulking Proxy for Elasticsearch

How the Proxy Works

When a request is made to PUT a document, the proxy will queue the request and immediately return a 202 Accepted response. As documents are queued, the proxy will batch them up and POST them to a target Elasticsearch bulk endpoint, such as /<index>/<doctype>/_bulk.

When a temporary problem is encountered writing to Elasticsearch, the proxy will begin backing off to avoid overloading ES. If a problem persists, the proxy will start returning 503 Service Unavailable errors and will no longer queue any documents.

Request Flow Diagram

Bulk Inserts

Bulk inserts are limited to 2 MiB of data. This limit is checked after adding a new document to the queue, so the actual amount of data will probably be a bit more than this.

Backoff

When the proxy can't connect to ES, or inserts become slow (>2s), or ES begins to report errors, the endpoint will be backed off. Backoff starts at 0.5s and increases up to 60s between attempts.

While backed off, requests that have ?refresh=true or ?refresh=wait_for will begin to take a long time. Other requests will be accepted immediately and queued.

Circuit Breaker

When the queue grows too large (over 250 MiB), the proxy will begin to return 503 errors to the client. This is too ensure the client doesn't continue to load data while the proxy continues to fall further behind.

Installation

sudo -H npm install -g @zingle/esbulker

Usage

Usage:
  esbulker [-v|-q] [--es=<url>] [--ip=<addr>] [--port=<num>]
  esbulker --help
  esbulker --version

Start elasticsearch bulk load proxy.

OPTIONS

  --help                Show this help.
  --es=<url>            Elasticsearch server URL.
  --ip=<addr>           IP address proxy listens on.
  --port=<num>          Port proxy listens on.
  -q|--quiet            Show less output.
  -v|--verbose          Show more output.
  --version             Display version information.`

ENVIRONMENT

  ES_URL                Elasticsearch server URL.
  LISTEN_ADDR           IP address proxy listens on.
  LISTEN_PORT           Port proxy listens on.

Additional Setup

The esbulker proxy only accepts PUT requests to a specific document type endpoint, that is /<index>/<doctype>/<id>. Nginx or another proxy should be used to split this acceptable traffic from the rest of the Elasticsearch traffic. The remaining traffic should be passed along to Elasticsearch.