Erik Dubbelboer
d4f0cf56d8
Remove fasthttp.ByteBuffer
...
As advertised in https://github.com/valyala/fasthttp/commit/b5f96d4b4120bb1e09c23ac32baf21a14da4a71d
2018-10-01 14:15:29 +08:00
Aliaksandr Valialkin
30e92af08f
Limit heap memory usage when compressing high number of concurrent responses
...
Previously each concurrent compression could allocate huge compression state
with the size up to 1Mb each. So 10K concurrent connections could result in
10Gb of compression state in the heap.
This CL limits the number of compression states among concurrent requests
when {Append,Write}{Gzip,Deflate}* functions are called to O(GOMAXPROCS).
These functions are used by CompressHandler* for non-streaming responses,
i.e. it should cover the majority of use cases.
Memory usage for 10K concurrent connections that compress responses drops
from 10Gb to 200Mb after this CL.
2017-05-17 14:45:31 +03:00
Aliaksandr Valialkin
f49c6b3f96
Reduce stack space usage when using response compression
2016-11-03 19:38:42 +02:00
Aliaksandr Valialkin
204fed9187
Revert "Use standard compress packages until https://github.com/klauspost/compress/issues/64 is fixed"
...
The original issue has been fixed, so reverting.
This reverts commit 2f4876aaf2 .
2016-10-20 18:02:21 +03:00
Aliaksandr Valialkin
2f4876aaf2
Use standard compress packages until https://github.com/klauspost/compress/issues/64 is fixed
2016-10-20 15:30:15 +03:00
Aliaksandr Valialkin
b131f05f50
Revert "Use standard compress/* packages instead of github.com/klauspost/compress/*"
...
According to @klauspost, his packages are still faster than the standard packages.
See https://github.com/valyala/fasthttp/commit/a98191f43560ea2ddbbf848c1c727daeed2e39ae#commitcomment-19409416
for details.
This reverts commit a98191f435 .
2016-10-13 14:57:35 +03:00
Aliaksandr Valialkin
a98191f435
Use standard compress/* packages instead of github.com/klauspost/compress/*
...
The reasons are:
- @klauspost optimized standard packages in go1.7+
- This removes an external dependency from fasthttp
2016-10-13 13:01:51 +03:00
Sebastian Schepens
889c65bae6
Added BodyInflate and WriteInflate to match BodyGunzip and WriteGunzip
2016-02-22 14:36:58 -03:00
Aliaksandr Valialkin
87628147e5
Use zero-alloc copy instead of io.Copy
2016-02-13 11:01:18 +02:00
Aliaksandr Valialkin
6210374fa8
Implement io.Writer in ByteBuffer and use it instead of bytes.Buffer in isFileCompressible
2016-02-11 19:36:43 +02:00
Aliaksandr Valialkin
bb2a414fe8
Issues #14 , #46 : use @klauspost 's compress library instead of standard compress/*, since it provides better performance on average
2016-02-10 16:40:14 +02:00
Aliaksandr Valialkin
999348e2d4
Issue #46 : use zlib instead of flate for deflate Content-Encoding
2016-02-08 16:51:03 +02:00
Aliaksandr Valialkin
52ddf98cfd
Fixed golint warnings
2016-01-19 12:43:23 +02:00
Aliaksandr Valialkin
a89d890c8c
Added WriteGzip and WriteGunzip helper functions
2016-01-04 15:27:13 +02:00
Aliaksandr Valialkin
0e7c44160c
Added AppendGzipBytesLevel for gzipping with desired compression level
2015-12-31 12:15:55 +02:00
Aliaksandr Valialkin
95456fa9d7
Added AppendGzipBytes and AppendGunzipBytes for simplifying gzipping/gunzipping request/response bodies
2015-12-31 12:09:21 +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
22c2acbb9d
Optimization: reuse gzip/flate readers and writers. This should improve response body compression/decompression performance a bit
2015-12-28 18:58:05 +02:00