Git Product home page Git Product logo

multi-request's Introduction

Multi Process Request

A request.js (https://www.npmjs.com/package/request) wrapper that support multi process request.

Installation

$ npm install multi-request

Usage

Just require the module like this: var MRequest = require("multi-request")

Callback style

MRequest("http://google.com",function(err,response,body){
	// do something
})

Promise style

MRequest("http://google.com").then(function(result){
	var response = result.response;
	var body = result.body;
}).catch(console.error)

Manage Worker usage

By default, multi-request will spawn maximum cpuLoad * cpuCount. You can change cpuLoad by calling .changeCpuLoad(num). For example :

MRequest.changeCpuLoad(3)

will set maximum Worker count to 3 * cpuCount. Please be alerted that currently multi-request only support expanding maximum worker count. If you try to call changeCpuLoad with parameter less than any subsequent call, it will not resulted in decreased running Worker. This feature is planned for future release.

How does it works?

multi-request initially spawn 1 Worker. As the request grows, multi-request will try spawn new Worker until maximum worker count is reached. For each API invocation, parameters that passed to API will be sent to a child process based on round-robin technique. Multi Process Request support request.js parameter, but still untested for file handling.

GitHub

https://github.com/aerios/multi-request

multi-request's People

Contributors

aerios avatar anwari666 avatar

Watchers

 avatar  avatar

Forkers

anwari666

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.