Giter VIP home page Giter VIP logo

bwp's Introduction

Background Worker Pool

BWP can handle different jobs and proceed them in the background. This will be useful when you need to execute long-time request from php or any other fast context without possibility of waiting for a response.

Features:

  • Job http -- Execute http request.
  • Setup IP from which http requests will be sent.
  • Graceful restart from updated binary

Web API

POST /post/http -- Submit new http request

The method accepts raw json content in the request body with the following format:

{
  "url": "https://google.com",
  "method": "GET", // Optional, GET by default
  "body": "base64 encoded raw body", // Optional
  "parameters": { // Optional, on GET or HEAD this will be appended to the url, othervise parameters will be in the POST args
    "foo": "bar"
  },
  "headers": { // Optional, any custom headers
    "X-Auth-Email": "[email protected]",
    "Cookie": "foo=bar"
  }
}

Multiple requests can also be sent at once using an array.

There is another way to send multiple requests:

{
  "method": "POST",
  "body": "eyJoZWxsbyI6IndvcmxkIn0=",
  "headers": {"X-Sender": "me"},
  "clones": [{
    "url": "https://first-secret-domain.com",
    "headers": {"X-Secret": "puppies"}
  }, {
    "url": "https://second-secret-domain.com",
    "headers": {"X-Secret": "kittens"}
  }]
}

As a result of the above request, bwp will send 2 http requests to https://first-secret-domain.com and https://second-secret-domain.com with the same body from the parent request.

GET /metrics -- Prometheus metrics page

Configuration

  • -listen addresses for binding a Web API, for multiple, separate with a comma
  • -pidfile path to pid file
  • -pool-size number of workers (default: 50)
  • -pool-queue-size max number of jobs in queue (default: 10000)
  • -ip-routes ip's from which http request will be sent (example: 172.16.0.0/12 -> 172.16.1.1, 0.0.0.0/0 -> auto)

bwp's People

Contributors

xtrafrancyz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mrtesla007

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.