
On 24/04/13 13:07, Russell Coker wrote:
On Mon, 22 Apr 2013, "Trent W. Buck" <trentbuck@gmail.com> wrote:
I assume you'd have a non-negligible amount of zlib CPU churn when paging out to zram -- is that noticable? I suppose it is, but only when you have pegged BOTH CPU and RAM.
Using zram is a trade-off of CPU performance vs disk IO performance. As CPU performance has been increasing steadily at an exponential rate for the last 20 years and disk performance has been increasing at a slow linear rate over that period such a trade-off becomes increasingly beneficial.
So much so that PostgreSQL and Riak databases compress data by default. (Caveats: Pg only compresses larger data types, not your basic ints or really short character strings. Riak only performs compression when using the LevelDB backend) A lot of advice for zfs and btrfs say that enabling transparent compression improves performance due to reduced disk i/o (on both reads and writes). Note that rather than using zlib, these guys tend to use faster algorithms, which give nearly-as-good compression in much-less time. eg: Snappy and LZO
Whether zram is better than SSD is another issue. With the Intel SSD I've tried the contiguous read and write speeds are quite a bit lower than that of hard disks and while the overall performance is a significant improvement over hard disks it's still not nearly as good as I'd hoped for. If SSD was as good as some people claim then zram might not offer much benefit.
SSD performance has improved quickly; an early Kingson SSD of mine only pushes ~85 MByte/s, whereas a later Samsung one can nearly max out a SATA 6Gb connection. The latter also handles far, far more random i/o writes, which shows up in postgresql pgbench results. (Which is more relevant to me than simply writing big files) In a benchmark I ran I compared a four-disk RAID10 array of 7200rpm sata drives against a single consumer-grade MLC Samsung SSD. Measured in transactions-per-second. Higher numbers are better. SATA RAID10 array: 698 TPS SSD drive: 7559 TPS That's an order of magnitude improvement. As far as I'm concerned, SSDs *are* as good as people claim :) Toby