{"id":1193,"date":"2022-07-05T16:31:17","date_gmt":"2022-07-05T15:31:17","guid":{"rendered":"https:\/\/www.marcinwilk.eu\/?p=1193"},"modified":"2022-07-05T17:17:04","modified_gmt":"2022-07-05T16:17:04","slug":"porownanie-kompresji-rar-bzip2-lbzip2","status":"publish","type":"post","link":"https:\/\/www.marcinwilk.eu\/en\/2022\/07\/porownanie-kompresji-rar-bzip2-lbzip2\/","title":{"rendered":"Comparison of rar, bzip2, lbzip2 compression"},"content":{"rendered":"Recently, I've been busy preparing various directories for additional archiving in Linux (it's about files from the \/var\/log\/ location) containing archives of reports of performed operations in the system and running programs (services such as www etc.). Since I often use archiving to RAR format, I decided to see if it would work in this case as well.\r\n\r\n<!--more-->\r\n\r\nI performed the test on Debian 11 (Linux kernel 5.10.0-13-amd64), on a system with 2 Xeon E5-2630L v2 processors, equipped with 64GB of RAM and an SSD (SATA) drive.\r\n\r\nFirst, I created a tar archive of the entire \/var\/log directory using the command \"time tar -pcf log.tar \/var\/log\". The created archive occupies 1.7GB on the disk. Below are the results done with these commands:\r\nrar archiving (registered v 6.12, from the manufacturer's website): time rar a -m5 -ma5 -md64m -mt24 -r \/log.rar \/log.tar\r\nbzip2 archiving (v 1.0.8, installed with apt): time bzip2 -k -z -9 log.tar\r\nlbzip2 archiving (v 2.5, installed with apt): time lbzip2 -k -z -9 log.tar\r\n\r\nThe time command allows you to determine the amount of time the command used to run. Here are the results:\r\n\r\n<div class=\"su-table su-table-alternate\">\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td>Archive (file name)<\/td>\r\n<td>Archive creation time (seconds)<\/td>\r\n<td>File size (KB)<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>log.tar<\/td>\r\n<td>2,64<\/td>\r\n<td>1758197<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>log.rar<\/td>\r\n<td>36,87<\/td>\r\n<td>276366<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>log.tar.bz2 (bzip2)<\/td>\r\n<td>313,06<\/td>\r\n<td>275410<\/td>\r\n<\/tr>\r\n<tr>\r\n<td>log.tar.bz2 (Lbzip2)<\/td>\r\n<td><strong>7,83<\/strong><\/td>\r\n<td><strong>274947<\/strong><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<\/div>\r\n\r\nAs you can see, the best performance is in archiving to a bz2 file, using lbzip2 (which is a bzip2 implementation capable of using multiple cores, hence the big speedup).<!-- \/wp:post-content --><input class=\"fooboxshare_post_id\" type=\"hidden\" value=\"1193\"\/>","protected":false},"excerpt":{"rendered":"<p>Sorry, this entry is only available in Polski.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,113,65,123],"tags":[66,177,173,178,40,176,130,120],"class_list":["post-1193","post","type-post","status-publish","format-standard","hentry","category-computers","category-hosting","category-linux","category-software","tag-bash","tag-bzip2","tag-debian","tag-lbzip2","tag-linux","tag-rar","tag-software","tag-statystyki"],"_links":{"self":[{"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/posts\/1193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/comments?post=1193"}],"version-history":[{"count":0,"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/posts\/1193\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/media?parent=1193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/categories?post=1193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.marcinwilk.eu\/en\/wp-json\/wp\/v2\/tags?post=1193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}