haproxy/include/types
Willy Tarreau 418b8c0c41 MAJOR: compression: integrate support for libslz
This library is designed to emit a zlib-compatible stream with no
memory usage and to favor resource savings over compression ratio.
While zlib requires 256 kB of RAM per compression context (and can only
support 4000 connections per GB of RAM), the stateless compression
offered by libslz does not need to retain buffers between subsequent
calls. In theory this slightly reduces the compression ratio but in
practice it does not have that much of an effect since the zlib
window is limited to 32kB.

Libslz is available at :

      http://git.1wt.eu/web?p=libslz.git

It was designed for web compression and provides a lot of savings
over zlib in haproxy. Here are the preliminary results on a single
core of a core2-quad 3.0 GHz in 32-bit for only 300 concurrent
sessions visiting the home page of www.haproxy.org (76 kB) with
the default 16kB buffers :

          BW In      BW Out     BW Saved   Ratio   memory VSZ/RSS
zlib      237 Mbps    92 Mbps   145 Mbps   2.58     84M /  69M
slz       733 Mbps   380 Mbps   353 Mbps   1.93    5.9M / 4.2M

So while the compression ratio is lower, the bandwidth savings are
much more important due to the significantly lower compression cost
which allows to consume even more data from the servers. In the
example above, zlib became the bottleneck at 24% of the output
bandwidth. Also the difference in memory usage is obvious.

More tests run on a single core of a core i5-3320M, with 500 concurrent
users and the default 16kB buffers :

At 100% CPU (no limit) :
          BW In      BW Out     BW Saved   Ratio   memory VSZ/RSS  hits/s
zlib      480 Mbps   188 Mbps   292 Mbps   2.55     130M / 101M     744
slz      1700 Mbps   810 Mbps   890 Mbps   2.10    23.7M / 9.7M    2382

At 85% CPU (limited) :
          BW In      BW Out     BW Saved   Ratio   memory VSZ/RSS  hits/s
zlib     1240 Mbps   976 Mbps   264 Mbps   1.27     130M / 100M    1738
slz      1600 Mbps   976 Mbps   624 Mbps   1.64    23.7M / 9.7M    2210

The most important benefit really happens when the CPU usage is
limited by "maxcompcpuusage" or the BW limited by "maxcomprate" :
in order to preserve resources, haproxy throttles the compression
ratio until usage is within limits. Since slz is much cheaper, the
average compression ratio is much higher and the input bandwidth
is quite higher for one Gbps output.

Other tests made with some reference files :

                           BW In     BW Out    BW Saved  Ratio  hits/s
daniels.html       zlib  1320 Mbps  163 Mbps  1157 Mbps   8.10    1925
                   slz   3600 Mbps  580 Mbps  3020 Mbps   6.20    5300

tv.com/listing     zlib   980 Mbps  124 Mbps   856 Mbps   7.90     310
                   slz   3300 Mbps  553 Mbps  2747 Mbps   5.97    1100

jquery.min.js      zlib   430 Mbps  180 Mbps   250 Mbps   2.39     547
                   slz   1470 Mbps  764 Mbps   706 Mbps   1.92    1815

bootstrap.min.css  zlib   790 Mbps  165 Mbps   625 Mbps   4.79     777
                   slz   2450 Mbps  650 Mbps  1800 Mbps   3.77    2400

So on top of saving a lot of memory, slz is constantly 2.5-3.5 times
faster than zlib and results in providing more savings for a fixed CPU
usage. For links smaller than 100 Mbps, zlib still provides a better
compression ratio, at the expense of a much higher CPU usage.

Larger input files provide slightly higher bandwidth for both libs, at
the expense of a bit more memory usage for zlib (it converges to 256kB
per connection).
2015-03-29 03:32:06 +02:00
..
acl.h MINOR: includes: fix a lot of missing or useless includes 2015-02-28 23:12:32 +01:00
arg.h MINOR: args: implement a new arg type for regex : ARGT_REG 2015-01-22 14:24:53 +01:00
auth.h MAJOR: auth: Change the internal authentication system. 2014-03-17 18:06:06 +01:00
backend.h MEDIUM: backend: add the crc32 hash algorithm for load balancing 2015-01-20 19:48:14 +01:00
capture.h MINOR: capture: extend the captures to support non-header keys 2014-06-13 16:32:48 +02:00
channel.h MEDIUM: channel: remove now unused ->prod and ->cons pointers 2015-03-11 20:41:47 +01:00
checks.h MEDIUM: protocol: automatically pick the proto associated to the connection. 2015-02-28 23:12:31 +01:00
compression.h MAJOR: compression: integrate support for libslz 2015-03-29 03:32:06 +02:00
connection.h MAJOR: namespace: add Linux network namespace support 2014-11-21 07:51:57 +01:00
counters.h MEDIUM: session: maintain per-backend and per-server time statistics 2014-06-17 17:15:56 +02:00
fd.h BUG/MEDIUM: polling: fix possible CPU hogging of worker processes after receiving SIGUSR1. 2014-05-20 14:57:36 +02:00
freq_ctr.h [MINOR] freq_ctr: add new types and functions for periods different from 1s 2010-08-10 14:01:09 +02:00
global.h MINOR: global: report information about the cost of SSL connections 2015-01-15 21:34:39 +01:00
hdr_idx.h
hlua.h MINOR: lua: create and register HTTP class 2015-03-18 11:34:06 +01:00
lb_chash.h [MEDIUM] build: switch ebtree users to use new ebtree version 2009-10-26 21:10:04 +01:00
lb_fas.h MEDIUM: backend: add the 'first' balancing algorithm 2012-02-21 22:27:27 +01:00
lb_fwlc.h [MEDIUM] build: switch ebtree users to use new ebtree version 2009-10-26 21:10:04 +01:00
lb_fwrr.h [MEDIUM] build: switch ebtree users to use new ebtree version 2009-10-26 21:10:04 +01:00
lb_map.h [CLEANUP] proxy: move last lb-specific bits to their respective files 2009-10-03 18:41:18 +02:00
listener.h MEDIUM: listener: store the default target per listener 2015-03-13 16:45:37 +01:00
log.h MINOR: lua: core: create "core" class and object 2015-02-28 23:12:34 +01:00
mailers.h MEDIUM: Allow configuration of email alerts 2015-02-03 00:24:16 +01:00
map.h MEDIUM: map: uses HAProxy facilities to store default value 2015-03-13 14:10:30 +01:00
obj_type.h DIET/MINOR: obj: pack the obj_type enum to 8 bits 2013-12-09 16:06:08 +01:00
pattern.h BUG/MEDIUM: patterns: last fix was still not enough 2014-04-28 14:19:17 +02:00
peers.h CLEANUP: Remove unused 'last_slowstart_change' field from struct peer 2013-11-19 08:04:59 +01:00
pipe.h
port_range.h [MEDIUM] add support for binding to source port ranges during connect 2009-06-10 12:23:32 +02:00
proto_http.h MEDIUM: http/tcp: permit to resume http and tcp custom actions 2015-02-28 23:12:33 +01:00
proto_tcp.h MEDIUM: tcp: add register keyword system. 2015-02-28 23:12:32 +01:00
protocol.h MEDIUM: listener: implement a per-protocol pause() function 2014-07-08 01:13:34 +02:00
proxy.h MINOR: proxy: store the default target into the frontend's configuration 2015-03-13 16:23:00 +01:00
queue.h MINOR: includes: fix a lot of missing or useless includes 2015-02-28 23:12:32 +01:00
sample.h MINOR: sample: add private argument to the struct sample_fetch 2015-02-28 23:12:31 +01:00
server.h MEDIUM: protocol: automatically pick the proto associated to the connection. 2015-02-28 23:12:31 +01:00
session.h REORG/MAJOR: move session's req and resp channels back into the session 2015-03-11 20:41:46 +01:00
signal.h [MEDIUM] signals: add support for registering functions and tasks 2010-08-27 18:00:40 +02:00
ssl_sock.h MEDIUM: Add support for configurable TLS ticket keys 2015-02-28 23:10:22 +01:00
stick_table.h CLEANUP: session: move the stick counters declarations to stick_table.h 2014-07-16 17:26:40 +02:00
stream_interface.h MEDIUM: stream-int: remove any reference to the owner 2015-03-11 20:41:46 +01:00
task.h DIET/MINOR: task: reduce struct task size by 8 bytes 2013-12-09 16:06:22 +01:00
template.h