Commit Graph

34 Commits

Author SHA1 Message Date
Aliaksandr Valialkin 32c72cde80 Export CoarseTimeNow and clarify that RequestCtx.Time() and RequestCtx.ConnTime() return time truncated to a second 2017-02-10 15:45:14 +02:00
Aliaksandr Valialkin 6309f42188 optimization: substitute time.Now() calls with coarse-grained time in hot paths 2017-02-09 23:59:06 +02:00
Aliaksandr Valialkin a2cc660e59 optimization: removed slow defer from worker pool handler and hijack handler 2016-07-18 17:23:38 +03:00
Aliaksandr Valialkin 886e541160 Removed 'recover-from-panic' band-aids.
All the panics must be handled by the user code.
2016-07-12 12:30:38 +03:00
Aliaksandr Valialkin a0377f758e workerpool: test cleaner 2016-03-31 14:56:39 +03:00
Aliaksandr Valialkin 9f20a62336 added workerpool tests 2016-03-31 14:41:27 +03:00
Aliaksandr Valialkin 4fa2d5db39 workerpool: bugfix: do not return workerChan to ready pool on panic 2016-03-31 12:37:46 +03:00
Aliaksandr Valialkin e64702d6f0 workerpool: removed a hack for recycling worker stacks, since Go runtime must be able to shrink big stacks when they aren't needed 2016-03-31 10:31:53 +03:00
Aliaksandr Valialkin 72352d7661 workerpool: limit the number of connections each worker may serve. This should reduce the total amount of memory occupied by worker stacks in the long term 2016-03-30 19:35:46 +03:00
Aliaksandr Valialkin 1f148c6c09 workerpool: properly clean scratch buffer for workerChans 2016-03-30 19:04:20 +03:00
Aliaksandr Valialkin 1d6b6a6608 workerpool: properly count workers 2016-03-30 18:45:57 +03:00
Aliaksandr Valialkin 92c779039c workerpool: clean workerChan slices in order to reduce the amount of work for GC 2016-03-30 18:11:40 +03:00
Aliaksandr Valialkin 8094a6e20f workerpool: reduced the time to hold the lock when cleaning unused worker goroutines 2016-03-30 16:40:16 +03:00
Aliaksandr Valialkin dbea792cf7 Scalability improvement: use distinct workerChan pool per each workerPool 2016-03-29 11:45:09 +03:00
Aliaksandr Valialkin 023e3807b8 workerPool optimization: determine the current time outside lock 2016-03-29 11:05:14 +03:00
Aliaksandr Valialkin e4c0cbe843 code prettifying 2016-03-02 16:10:38 +02:00
Aliaksandr Valialkin ed7ca4c631 Added LogAllErrors config parameter to Server, which allows logging the most frequent errors such as 'connection reset by peer', 'broken pipe' and 'i/o timeout'. By default such errors are suppressed 2016-02-19 12:01:27 +02:00
Aliaksandr Valialkin a9a9b08a84 Do not pollute server error log with 'i/o timeout' errors 2016-01-28 12:03:07 +02:00
Aliaksandr Valialkin 180e104034 Fixed misleading comments in workerpool 2015-12-10 12:05:36 +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 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 bc85e2b572 workerpool: immediately switch to connection processing if GOMAXPROCS=1. This improves single-threaded server performance by 1-2% 2015-11-26 12:38:18 +02:00
Aliaksandr Valialkin 45e1d5a313 fixed a typo 2015-11-24 13:59:51 +02:00
Aliaksandr Valialkin cd4ace5409 Close connection and release worker channel on panic in WorkerFunc 2015-11-24 13:40:39 +02:00
Aliaksandr Valialkin 146145240d Added RequestCtx.Hijack() for connections' hijacking 2015-11-23 19:41:43 +02:00
Aliaksandr Valialkin bb38369834 Suppress too chatty 'reset by peer' errors when serving clients, which unexpectedly close connections 2015-11-23 13:01:36 +02:00
Aliaksandr Valialkin 76f453b7fc Suppress too chatty 'broken pipe' errors when serving clients, which unexpectedly close connections 2015-11-23 12:57:37 +02:00
Aliaksandr Valialkin 6e4b32182e Fixed panic when WorkerFunc returns error and Conn is closed 2015-11-12 14:01:04 +02:00
Aliaksandr Valialkin f4223fbb70 Added missing unlock when stopping worker pool 2015-11-11 18:08:15 +02:00
Aliaksandr Valialkin a4e8e226ff Removed dubious loop for obtaining free worker - just increase the number of workers if 'no free workers' error occur 2015-11-11 16:39:59 +02:00
Aliaksandr Valialkin 69758b81d6 Accept net.Conn instead of io.ReadWriteCloser in Serve*() methods, since in reality we use net.Conn methods such as RemoteAddr, SetReadDeadline and SetWriteDeadline 2015-11-11 16:17:12 +02:00
Aliaksandr Valialkin ae6a7cc17c Extracted workerPool from server.go into workerpool.go 2015-11-11 15:27:27 +02:00