Commit Graph

92 Commits

Author SHA1 Message Date
Aliaksandr Valialkin f36b47782a removed memory allocations from tryDial. This should improve performance for non-keepalive connections 2016-05-16 17:17:18 +03:00
Aliaksandr Valialkin 281be30c26 Client optimization: reduce the number of SetReadDeadline/SetWriteDeadline calls for keep-alive connections, since they don't scale properly. See https://github.com/golang/go/issues/15133 for details. 2016-04-15 23:33:41 +03:00
Aliaksandr Valialkin e9544cbb6f client: get rid of slow math/rand for sleep jitter generation 2016-04-04 15:02:33 +03:00
Aliaksandr Valialkin 3f0e1bb92f PipelineClient: take into account queued requests waiting to be sent to the server in PendingRequests() 2016-04-03 11:19:52 +03:00
Aliaksandr Valialkin 9c292dcd3e PipelineClient: do not send timed out requests to the server 2016-04-03 11:11:27 +03:00
Aliaksandr Valialkin 316adc4782 PipelineClient.Do: try substituting the oldest request in the pending queue by the current one on queue overflow 2016-04-03 10:58:55 +03:00
Aliaksandr Valialkin 8ae2d3e53c PipelineClinet: added MaxBatchDelay option 2016-04-02 23:18:34 +03:00
Aliaksandr Valialkin ca21b21eba Return ErrPipelineOverflow from PipelineClient.Do if the pending requests' queue is overflown. This should prevent from caller's goroutines leak on stalled pipeline client 2016-04-01 18:21:35 +03:00
Aliaksandr Valialkin 22c9594090 Added PipelineClient for issuing pipelined requests to the server 2016-04-01 18:06:59 +03:00
Aliaksandr Valialkin 3298603593 client: added MaxIdleConnDuration for limiting the duration of idle keep-alive connections established by clients 2016-03-30 19:23:17 +03:00
Aliaksandr Valialkin 124195fdd8 create new default tls.Config instead of re-using existing config, since it may not be copied due to sync.Once member 2016-03-06 19:11:34 +02:00
Aliaksandr Valialkin 8280b7a162 Moved empty noCopy struct to the top of container structs. See @stemar94 's comment at https://github.com/golang/go/issues/12884 for details 2016-03-06 00:17:08 +02:00
Aliaksandr Valialkin 9f43aa1601 Do not expose noCopy.Lock 2016-03-04 21:20:52 +02:00
Aliaksandr Valialkin 9fa69c74af Embed noCopy struct into structs, which mustn't be copied
This should help `go vet` detecting invalid structs' copyings.
See https://github.com/golang/go/issues/8005#issuecomment-190753527 for details.
2016-03-04 16:57:24 +02:00
Aliaksandr Valialkin 3546c31c2b Issue #60: skip body copying in DoTimeout. This should improve DoTimeout performance when dealing with big request and/or response bodies 2016-03-01 01:13:50 +02:00
Aliaksandr Valialkin e252d37e21 Issue #57: Added DisableHeaderNamesNormalizing config option to Client and HostClient to be consistent with the corresponding option in Server 2016-02-29 13:11:32 +02:00
Aliaksandr Valialkin 7583b9b2ac client: use exponential backoff algorithm for sleeping between unsuccessful attempts to obtain free connection to the server. This should reduce CPU usage 2016-02-22 19:05:46 +02:00
Aliaksandr Valialkin 0ab0d45a50 Eliminated two memory allocations when client follows redirect 2016-02-19 17:27:47 +02:00
Aliaksandr Valialkin 9c9b5abffa Documentation update according to golint 2016-02-12 17:47:57 +02:00
Aliaksandr Valialkin df85922f86 Added (Get|Do)Deadline helper functions to Client and HostClient 2016-02-10 13:35:48 +02:00
Aliaksandr Valialkin a2e6d65e9d Issue #15: return more clear error if the server forgets sending 'Connection: close' response header before closing the connection 2016-02-05 13:45:46 +02:00
Aliaksandr Valialkin df213349e2 client: use TLS session cache by default 2016-02-04 20:24:00 +02:00
Aliaksandr Valialkin c450104658 Client: made more clear timeout handling 2016-01-29 13:38:56 +02:00
Aliaksandr Valialkin e3369ec00b Dial all the resolved TCP addresses in round-robin manner until the connection is established 2016-01-15 19:41:09 +02:00
Aliaksandr Valialkin 576ba8868b Return immediately on ErrDialTimeout when dialing HostClient hosts 2016-01-15 19:12:09 +02:00
Aliaksandr Valialkin a5f4f2e007 Dial all available addresses in HostClient.Addrs before giving up 2016-01-15 19:08:40 +02:00
Aliaksandr Valialkin c78eb83578 Client: re-send idempotent requests after more unsuccessful cases 2016-01-15 18:30:13 +02:00
Aliaksandr Valialkin b0ded12af6 Do not create new connection on idempotent requests' retry, since it has little sense 2016-01-15 16:56:30 +02:00
Aliaksandr Valialkin 92b182c4b1 Added ability to limit the maximum connection duration in HostClient 2016-01-13 14:06:05 +02:00
Aliaksandr Valialkin c8f577c7f1 Added ability to balance requests among multiple upstream hosts via HostClient 2016-01-12 11:08:24 +02:00
Aliaksandr Valialkin c5d9023043 Issue #30: properly handle content-length for HEAD responses 2016-01-05 18:02:50 +02:00
Aliaksandr Valialkin 8cd2f8da6b Added more parallel benchmarks for the client 2015-12-29 17:18:15 +02:00
Aliaksandr Valialkin 95093e35cf Removed redundant Reset() calls on bufio.Reader/bufio.Writer/gzipWriter/flateWriter before returning them to the pool, since Reset() is immediately called after these instances are obtained from pool 2015-12-29 15:10:14 +02:00
Aliaksandr Valialkin d2db95337f Removed 'v interface{}' hack from structs managed via sync.Pool, since it has no sense 2015-12-23 11:39:40 +02:00
Aliaksandr Valialkin cf6efe4c3f Export AcquireRequest, AcquireResponse, ReleaseRequest and ReleaseResponse 2015-12-19 20:25:03 +02:00
Aliaksandr Valialkin f520ed8177 Follow-up tests after the pull request #19: added missing tests 2015-12-16 20:00:17 +02:00
招牌疯子 cd6b2ebf66 Fixed client copy resp from respCopy inversely 2015-12-16 13:50:03 +08:00
Aliaksandr Valialkin 0ac2d5f35e Removed DialTLS*, since it must be handled by client code 2015-12-07 16:44:14 +02:00
Aliaksandr Valialkin 9c70042061 Exported default TCP dialers used by clients, so custom wrappers may be implemented around these dialers 2015-12-07 16:12:28 +02:00
Aliaksandr Valialkin 32022e42d0 Documentation fix for Do() 2015-12-07 13:55:59 +02:00
Aliaksandr Valialkin 4ac44f0c6c Mention which structs are safe for use from concurrently running goroutines (Server, Client and HostClient) and which structs are unsafe to use from concurrently running goroutines - all the other 2015-12-03 13:38:59 +02:00
Aliaksandr Valialkin 3c903772f2 Avoid memory allocation when cleaning stale workers and connections 2015-12-02 08:24:55 +02:00
Aliaksandr Valialkin 235d4932da Check for stale workers and connections every 10 seconds instead of every second. This should reduce cleaners' overhead 2015-12-01 13:42:53 +02:00
Aliaksandr Valialkin a3965934a1 Simplify GC life by zeroing references to closed worker chans and client conns 2015-12-01 13:32:05 +02:00
Aliaksandr Valialkin d0289e11d9 Allow TCP addresses without port in HostClient 2015-11-30 18:22:45 +02:00
Aliaksandr Valialkin f214dc327f Scalability improvement: do not move read workers' queue when cleaning old workers. This should reduce latencies when server serves multi-million concurrent connections 2015-11-30 11:26:39 +02:00
Aliaksandr Valialkin 3a31c4bdef cleaned up some cruft in Client.Do 2015-11-29 12:22:18 +02:00
Aliaksandr Valialkin 3a406649a1 Retry PUT requests as they are idempotent according to http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 2015-11-29 12:07:46 +02:00
Aliaksandr Valialkin a86ebd88ea Issue #7: fixed unaligned 64-bit access on ARM in client code 2015-11-28 20:10:18 +02:00
Aliaksandr Valialkin 8563a2e762 Follow redirects in client Get* and Post* methods. Added Redirect method to RequestCtx. 2015-11-28 14:47:19 +02:00