| 6 | | Starting with version 5.4, the BOINC client is able to handle HTTP `Content-Encoding` types 'deflate' |
| 7 | | (zlib algorithm) and 'gzip' (gzip algorithm). |
| 8 | | The client decompresses these files 'on the fly' and stores them on disk in uncompressed form. |
| 9 | | This can be used in the following two ways. |
| 10 | | |
| 11 | | Both methods store files uncompressed on the client. |
| 12 | | If you need compression on the client, you must do it at the application level (see below). |
| 13 | | |
| 14 | | ==== gzip encoding ==== |
| 15 | | To use this method, gzip your downloadable files, giving them a filename suffix such as '.gz'. |
| 16 | | (The name used in your `<file_info>` elements, however, is the original filename without '.gz'). |
| 17 | | |
| 18 | | This method has the advantage of reducing server disk usage and server CPU load, |
| 19 | | but it will only work with 5.4+ clients. |
| 20 | | BOINC clients older than 5.4 won't be able to download files. |
| 21 | | Use the 'min_core_client_version' entry in config.xml to enforce this. |
| 22 | | |
| 23 | | {{{ |
| 24 | | # Add encoding type |
| 25 | | AddEncoding x-gzip .gz |
| 26 | | |
| 27 | | Alias /boinc/download /path/to/files/download |
| 28 | | |
| 29 | | <Directory /path/to/files/download> |
| 30 | | Options Indexes FollowSymlinks MultiViews |
| 31 | | AllowOverride AuthConfig |
| 32 | | Order allow,deny |
| 33 | | Allow from all |
| 34 | | |
| 35 | | RewriteEngine on |
| 36 | | RewriteCond %{HTTP:Accept-Encoding} gzip.*deflate|deflate.*gzip |
| 37 | | RewriteCond %{REQUEST_FILENAME} "\.(vmdk|exe|dll|pdb)$" |
| 38 | | RewriteCond %{REQUEST_FILENAME}.gz -f |
| 39 | | RewriteRule ^.*$ %{REQUEST_URI}.gz [L] |
| 40 | | |
| 41 | | <FilesMatch ".*\.(vmdk|exe|dll|pdb)\.gz$"> |
| 42 | | ForceType application/octet-stream |
| 43 | | Header set Content-Encoding gzip |
| 44 | | </FilesMatch> |
| 45 | | |
| 46 | | SetOutputFilter DEFLATE |
| 47 | | SetEnvIfNoCase Request_URI \.(?:gz|gif|jpg|jpeg|png)$ no-gzip dont-vary |
| 48 | | </Directory> |
| 49 | | }}} |
| 50 | | This configuration tells Apache to redirect to the statically compressed files |
| 51 | | if the extension is vmdk, exe, dll, or pdb. |
| 52 | | All other files are compressed on-the-fly from the download directory except for files |
| 53 | | that end with `gz`,`gif`,`jpg`,`jpeg` and `png`. |
| 54 | | |
| 55 | | An alternate way to specify the files is the following: |
| 56 | | {{{ |
| 57 | | Alias /boinc/download /path/to/files/download |
| 58 | | |
| 59 | | <Directory /path/to/files/download> |
| 60 | | AddOutputFilter DEFLATE .faa .mask |
| 61 | | </Directory> |
| 62 | | }}} |
| 63 | | This configuration tells Apache to compress only the file types `.faa` and `.mask` |
| 64 | | served from the download directory. |
| 65 | | ==== Apache mod_deflate ==== |
| 66 | | You can use the Apache 2.0 mod_deflate module to automatically compress files on the fly. |
| 67 | | See http://httpd.apache.org/docs/2.0/mod/mod_deflate.html. |
| 68 | | This method will work with all BOINC clients, but it will do compression only for 5.4+ clients. |
| 69 | | |
| 70 | | You can use this in conjunction with gzip encoding because the mod_deflate module |
| 71 | | allows you to exempt certain filetypes from on-the-fly compression. |
| 72 | | |
| 73 | | This method increases CPU load on the web server, but this is typically not significant. |
| 74 | | |
| 75 | | You'll need to modify your `httpd.conf` file; example: |
| 76 | | |
| 77 | | {{{ |
| 78 | | # Enable module |
| 79 | | LoadModule deflate_module modules/mod_deflate.so |
| 80 | | |
| 81 | | # Log file compression |
| 82 | | DeflateFilterNote Input instream |
| 83 | | DeflateFilterNote Output outstream |
| 84 | | DeflateFilterNote Ratio ratio |
| 85 | | |
| 86 | | LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate |
| 87 | | CustomLog logs/deflate_log deflate |
| 88 | | |
| 89 | | # Use low settings for compression to make sure impact on server is low |
| 90 | | DeflateMemLevel 2 |
| 91 | | DeflateCompressionLevel 2 |
| 92 | | }}} |
| 93 | | |
| | 6 | |
| | 7 | The BOINC client can handle compressed downloads |
| | 8 | using both the gzip and mod_default mechanisms supported by Apache. |
| | 9 | However, resumption of interrupted downloads doesn't work |
| | 10 | with either of these methods, so we don't recommend using them. |
| | 11 | |
| | 12 | For [AppVersionNew application version files], you can specify a '''<gzip/>''' flag. |
| | 13 | This will cause the file to be transferred in compressed form to 7.0+ clients. |
| | 14 | |
| | 15 | If there is demand, we will extend this mechanism to |
| | 16 | work for job input files also. |