
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
request-balancer
Advanced tools
Provide local load balancer on top of request promise, usefull for microservice call
HTTP(s) Local load balancer client based on request-promise : https://www.npmjs.com/package/request-promise
npm install request-balancer
The main porpose of this library is to provide a basic HTTP(s) load balancer client to send http request to a microservice composed of several nodes, as netflix OSS java 'Ribbon' library does.
Now imagine you have deploy three instance of your microservice with the following host and port:
| node | host | port |
|---|---|---|
| #1 | node1.test.domain.org | 3010 |
| #2 | node2.test.domain.org | 3020 |
| #3 | node3.test.domain.org | 3070 |
Each instance expose a service to get the weather using the following request : GET http://{host:port}/weather?town=paris
To load balance over this three instances you must use request-balancer as follow:
let Rpb = require('../request-balancer');
let rpb = new Rpb(['http://node1.test.domain.org:3010', 'http://node2.test.domain.org:3020', 'http://node3.test.domain.org:3070'], {
timeout: 2000,
maxError: 1
});
rpb.send({
path:'/weather?town=paris',
method:'GET'
}).then(function(response){
console.log(response);
});
Request balancer come as class you must instanciate to keep the context of round robin balancing
endpoints : is an array of uri of all the endpoints to load balance onoptions
timeout : in order to 'fail fast', it is possible to set the timeout on a request send to endpoints. If it timeout, load balancer send the request to the next endpoint.maxError : maximum number of consecutive error after the library consider the endpoint as dead, error counter are reset every healthCheckPeriodhealthCheckPeriod : period after the library perform a health check on each endpointoptions same as original request library except:
path replace the uri field of request, instead of providing the full uri only the uri path is providedFAQs
Provide local load balancer on top of request promise, usefull for microservice call
The npm package request-balancer receives a total of 3 weekly downloads. As such, request-balancer popularity was classified as not popular.
We found that request-balancer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.