Coder Social home page Coder Social logo

http-deduplicate's Introduction

http-deduplicate

build status

Deduplicate multiple http request to a single endpoint.

You have an application composed of multiple HTTP servers, and you need to issue HTTP requests from your frontend to other internal endpoints. So, you call your endpoint for all requests. This module allows you to reduce the traffic and response time by calling a given URL only once at any given interval.

In my tests, http-deduplicate increases the throughput by a 2-5x factor, depending on the application.

Install

npm install http-deduplicate -g

Example

deduplicate(url, function (err, data, cb) {
  // do something async
  cb()
  // cb is optional and can be omitted
})

See example.js for a full example

API

deduplicate(address, callback(err, data [, cb]))

Calls address (as defined inhttp and https only once in a given period, all the other requests will receive the same data.

For extreme optimizations in high load scenarios, you can serve the latest returned value up until all callback (if present) are called.

TODO

  • HTTP headers
  • HTTP caching (ETag)
  • HTTP caching (Last-Modified)

Acknowledgements

http-deduplicate is sponsored by nearForm.

License

MIT

http-deduplicate's People

Contributors

mcollina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

http-deduplicate's Issues

what does this do?

the title of this module has two words that usually intrigue me but i'm not completely sure what this does

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.