Code Monkey home page Code Monkey logo

goutil's Issues

workshop如何限制资源的?

@henrylee2cn
1.这里workshop相当于在100万个协程中分别执行,和不使用workshop有啥区别? worker并不是在一个协程执行的啊?
https://github.com/henrylee2cn/goutil/blob/5b5425bff75ce88e91a6122e91fb7f0d751b8d16/pool/workshop_test.go#L73-L83

2.workshop和直接使用协程对比
=== RUN TestGoChan
--- PASS: TestGoChan (0.30s)
workshop_test.go:35: pool_size:50, requests:100000, one_logic_cost:10ms, total_cost:295ms, QPS:338983
=== RUN TestChanPool
--- PASS: TestChanPool (20.04s)
workshop_test.go:35: pool_size:50, requests:100000, one_logic_cost:10ms, total_cost:20.043s, QPS:4989
=== RUN TestWorkshop
--- PASS: TestWorkshop (0.39s)
workshop_test.go:100: workshop stats: {Worker:50 Idle:50 Created:50 Doing:0 Done:100000 MaxLoad:0 MinLoad:0}
workshop_test.go:35: pool_size:50, requests:100000, one_logic_cost:10ms, total_cost:394ms, QPS:253807
goos: windows
goarch: amd64
pkg: workshop
其中第一个是仅使用100万go 协程,代码如下:
`
wg := new(sync.WaitGroup)

wg.Add(requests)
startNano := time.Now().UnixNano()
for i := 0; i < requests; i++ {
	go func() {
		defer wg.Done()
		worker := 	&testWorker{}
		worker.Do()
	}()
}
wg.Wait()
reportStat(t, startNano)`

go mod bug

我使用的是 go mod 管理包

我使用 go mod tidy 后只会下载

github.com/henrylee2cn/goutil v0.0.0-20190226083422-6a93115ffd79 // indirect

会报错

build command-line-arguments: cannot load github.com/henrylee2cn/goutil/tpack: cannot find module providing package github.com/henrylee2cn/goutil/tpack

versioning.go 报错

当semVer="1.11"时Parse方法会return nil errors.New("invalid semantic version 2: " + semVer )导致tpack.go init的时候直接panic

close unhealthy work

你好, 最近看了一下你的视频和源码。
在 hire worker的时候进行了worker的健康状态检查。
假设有这样一个场景:
worker a 目前正在有n个任务子在执行(n个任务在hire worker的时候都没有发生错误),
此时worker a 也是负载最小的一个,新来了一个任务b, 任务b会被分配给woker a 执行, 但是在分配的时候检测到worker a不正常了, 此时采取的策略是关闭 worker a。 但是worker a此时有n个任务被绑定执行, 那岂不是这n个任务全部失败了?

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.