From owner-freebsd-small Tue Jul 17 17: 1:48 2001 Delivered-To: freebsd-small@freebsd.org Received: from kalaid.f2f.com.ua (kalaid.f2f.com.ua [62.149.0.33]) by hub.freebsd.org (Postfix) with ESMTP id 7F5B537B405; Tue, 17 Jul 2001 17:01:37 -0700 (PDT) (envelope-from sobomax@FreeBSD.org) Received: from mail.uic-in.net (root@[212.35.189.4]) by kalaid.f2f.com.ua (8.11.4/8.11.4) with ESMTP id f6I02lB02793; Wed, 18 Jul 2001 03:02:51 +0300 (EEST) (envelope-from sobomax@FreeBSD.org) Received: from notebook.vega.com (das0-l102.uic-in.net [212.35.189.229]) by mail.uic-in.net (8.11.4/8.11.4) with ESMTP id f6I00pk01057; Wed, 18 Jul 2001 03:00:53 +0300 (EEST) (envelope-from sobomax@FreeBSD.org) Date: Wed, 18 Jul 2001 03:00:53 +0300 (EEST) Message-Id: <200107180000.f6I00pk01057@mail.uic-in.net> To: alex@big.endian.de Cc: small@FreeBSD.org, arch@FreeBSD.org From: Maxim Sobolev Subject: Re: Extending md(4) to allow it use pre-compressed disk image X-Mailer: Pygmy (v0.5.10) In-Reply-To: <20010717194812.A804@zerogravity.kawo2.rwth-aachen.d> Sender: owner-freebsd-small@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 17 Jul 2001 19:48:12 +0200, Alexander Langer wrote: > Thus spake Maxim Sobolev (sobomax@FreeBSD.ORG): > > > size could vary), compresses each cluster using zlib and writes > > compressed clusters along with information about offset of each > > cluster into resulting image. After that compressed image could be put > > You sure that you don't produce that much overhead with all the > additional gzip headers that it doesn't worse the compression? That depends on how big your "much" is ;). It certainly produces some overhead compared to the plain gzip'ed file due to following reasons: additional index with offset of each compressed cluster (4 bytes per cluster) and clustering, which means that pieces of input treated by zlib as a fully independend data, that obviously limits the compression ratio. The former is rather small, as you can easily calculate with 16KB per cluster there will be only 1280 clusters for a 20MB image, which occupes only 5KB of data, while the latter is much bigger and it significantly depends on the size of cluster used. The following table compares results of compressing 10MB test image, which contains /bin and /etc subdirs from my workstation using different block sizes: Original size of the image: 10485760 bytes Size of the image when compressed with gzip -9: 3855949 bytes Cluster Size of Compressed Overhead Compared Amount ofRAM Size Image to gzip'ed Image Saved ------- ------------------ ----------------- ------------ 512 5,932,330 54% 4,553,430 1024 5,246,779 36% 5,238,981 2048 4,792,210 24% 5,693,550 4096 4,482,894 16% 6,002,866 8192 4,258,122 10% 6,227,638 16384 4,111,334 7% 6,374,426 32768 4,004,817 4% 6,480,943 65536 3,939,527 2% 6,546,233 Both the driver and compression utility support different block sizes, so it is really up to user whether he preffers performance over compression ratio or compression ratio over performance. Obviously that with the larger block sizes the driver will do more and more redundant work because to read some, arbitrary small portion of the cluster the driver has to decompress the whole cluster. However, provided simple MRU cahe effectively masks this effect by holding dozen of the most recently used clusters in decomressed form, so that from the performance standpoint difference between the cluster size of 512 bytes and cluster size of 16KB is ralatively small. > > I would like to know if there is enough interest in integrating this > > feature into base system, please let me know what do you think about > > it. > > Can you tell loader to load a mfs-compressed.gz? (I hope so) Yes, obviously you can, but unfortunately compression ratios achieved by compressing already compressed `mfs-compressed' images are rather low (typically less than 1%), so you wouldn't gain too much this way. :(( Please feel free to contact me with any other questions you might have. I think that among other things this new feature could be very useful to lower down minimal memory requirements during installation process, which could be a concern if we will move away from the plain old sysinstall(8) to a some GUI-based tool. -Maxim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-small" in the body of the message