Giter VIP home page Giter VIP logo

pool's People

Contributors

ewohltman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pool's Issues

Bulk hits waiting in pool

Hi,
when i test code with bulk messages (nearly 1lakh), all messages are waiting in pool and getting responses after sometime but i want to get responses concurrently

Note: for single message, i'm getting response immediately

Sample Code:
` package main
import (
"net/http"
"bytes"
"strconv"
"encoding/json"
"github.com/ewohltman/pool"
)

var HTTPClient = &http.Client{}
var PoolClient = pool.NewPClient(HTTPClient,200,250)

func main() {
	src:="123"
	dest:=1234567890
	msg:="dsjfhdkfhjd0"
	bst:="http://test/callbackurl"
	jsonStr := []byte(`{
		"test1": {
		  "src": "`+src+`",
		  "dest": `+strconv.Itoa(dest)+`,
		  "msg": "`+msg+`",
		  "url": "`+bst+`"
		}
		"test2": {
		  "id": 82109
		}
		}
		`)
	apiUrl := "https://test/message"
		
	jsonStr1,err:=	json.Marshal(jsonStr)
	req, err := http.NewRequest("POST", apiUrl, bytes.NewBuffer(jsonStr1)) 
	if err!=nil{
		panic(err)
	}

	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("requestid", "82109")
	req.Header.Set("Authorization", "Bearer Mi84T0FBQUF5S1VHY2YvczU2MnNYTFYxV0RtVDVybjFHRGhqNXc1ZWo1QlpwRmRmUzhZPSIsImFtciI6WyJwd2QiXSwiYXBwaWQiOiIxZjIyNTdmZS1iM2I5LTRkNjctOTNmMi1kYzYzNjdkNjBjODAiLCJhcHBpZGFjciI6IjAiLCJpcGFkZHIiOiI0MC44MS43")

	resp, err := PoolClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
}

`

Memory usage is very large

When I use this tool to query a lot of urls,urls will put the result to groutines,finally i find
resp, err := reqPool.PooledClient.Do(req) will create a a lot of groutines,and memory is fastly Growing。

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.