From 111524f7802b6e902d3003792c3d9e19a121ee63 Mon Sep 17 00:00:00 2001 From: a <a@a.a> Date: Tue, 13 Sep 2022 02:53:10 -0500 Subject: [PATCH] commentz --- lib/gat/gatling/conn_pool/conn_pool.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gat/gatling/conn_pool/conn_pool.go b/lib/gat/gatling/conn_pool/conn_pool.go index 74347af6..c8f9ae2a 100644 --- a/lib/gat/gatling/conn_pool/conn_pool.go +++ b/lib/gat/gatling/conn_pool/conn_pool.go @@ -51,6 +51,10 @@ type ConnectionPool struct { pool gat.Pool shards []shard + // see: https://github.com/golang/go/blob/master/src/runtime/chan.go#L33 + // channels are a thread safe ring buffer implemented via a linked list of goroutines. + // the idea is that goroutines are cheap, and we can afford to have one per pending request. + // there is no real reason to implement a complicated worker pool pattern when well, if we're okay with having a 2-4kb overhead per request, then this is fine. trading space for code complexity workerPool chan *worker // the lock for config related things mu sync.RWMutex -- GitLab