About | Download | Features | Install | Configure | Run |
Fast download time is essential for today's websites. Most solutions, like load-balancers, focus on scaling the number of connections, by spreading the load among multiple webservers. However, these solutions do not help reduce the download time for individual requests.
ViCompress is a free and open-source HTTP compression and caching proxy server. It reduces download time by gzip compressing text pages before sending them on the client. This results in faster download times, especially over slow connections, such as mobile device connections. ViCompress can reduce a 100 KB HTML page to 20 KB, cutting the download time by 80%.
ViCompress works with existing web servers and web browsers. All modern browsers (Internet Explorer, Firefox, Safari, Chrome) recognize gzip-encoded data, and will automatically decompress the data on the fly. Also, ViCompress can compress both static and dynamic web pages, including Apache/PHP, Microsoft ASP pages, Perl CGI scripts, and others.
ViCompress does not support HTTPS or FTP.
ViCompress can be used in three modes:
|
|
|
|
|
|
|
|
|
|
|
Click below to download ViCompress for Microsoft Windows or Linux.
|
|
|
|
ViCompress supports the following features:
Forward and Reverse Proxy | When ViCompress receives an HTTP request, it must forward the request to an origin webserver. The webserver configuration option determines where ViCompress forwards the request. ViCompress supports three modes of forwarding:
Network related options: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Compression | ViCompress supports in-memory compression of text pages, such as:
ViCompress sends a special HTTP header when it compresses any pages, so that the browser is aware the page is compressed: Content-Encoding: gzip The web browser automatically decompresses the gzipped page, and displays it to the user. No additional or special client software is needed. All modern web browsers recognize gzip content encoding, including:
In addition, ViCompress will not send gzipped content to browsers that do not support it. Browsers that recognize gzip compression send a special HTTP header in the request: Accept-Encoding: gzip ViCompress first checks for this header before gzipping any pages. Compression related options: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Caching | ViCompress supports in-memory caching of static data, such as HTML pages and images. The pages/images are cached in memory only, not on disk. When a browser requests an item found in the cache, ViCompress will send the response directly, rather than contacting the destination webserver. This results in faster response time, and reduces the load on the backend webservers.
ViCompress will not cache web pages that are generated dynamically, such as through ASP, PHP, or CGI scripts. ViCompress looks for two HTTP headers
to determine whether a response is dynamically generated or not. Only responses which contain an If the When the in-memory cache becomes full, items that have not been recently accessed are removed to make room for new items in the cache. Users can view the list of URLs in the memory cache by logging into the ViCompress machine and sending the following special URL to ViCompress:
https://127.0.0.1:<port>/_viewcache_
ViCompress will return a plain text list of the URLs in the cache, one per line. You can retrieve this list only from an http client on the same machine as ViCompress. Outside clients cannot access the cached URL list. Caching related options: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Load Balancing and Failover | When one or more webserver entries are specified, ViCompress will act as a reverse HTTP proxy, and will distribute requests among the backend webservers. When choosing a backend webserver, ViCompress picks the webserver with the least number of connections. If the webservers have the same number of connections, then ViCompress picks the webserver that was least recently used.
If ViCompress fails to connect to a backend web server, that web server is marked as down, and will be skipped for future requests. Clients that had previous sessions with that web server will be forwarded to a new backend web server. ViCompress will try to re-connect to a down web server every 3 minutes. If the connection succeeds, the web server is marked as up again. If all backend web servers are down when a request arrives, ViCompress will simply choose among the down web servers. Many web applications keep session information for each client, such as shopping cart items. Session information may be stored on a central database, or may be stored locally on individual web servers. If your website stores session information on individual web servers, then a client's requests cannot be distributed across multiple web servers. To force a client to use the same backend web server throughout a session, ViCompress provides the
For the duration of the session, the client browser will send the vicompressid Cookie for every request:
ViCompress will forward the requests to the backend webserver specified by the cookie. When the client browser is closed, the browser discards the vicompressid Cookie, and the session is ended. Note that if sessions are enabled, client connections may not be evenly distributed across the multiple backend web servers. Load Balancing related options: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Files | Log Format
ViCompress produces two log files: an access log and error log. The accesslog stores information about each client request on a single line. It is used for gathering website statistics. The
Log Rotation The accesslog file can grow quickly under heavy load. Therefore, ViCompress will automatically rotate log files once they reach a certain size. This size is given by the configuration option:
ViCompress will save up to two previous copies of the accesslog. When rotation occurs, ViCompress will execute the following:
mv accesslog.1 accesslog.2
mv accesslog accesslog.1 and will then create a new, empty accesslog file. Error Log The error log stores error and debugging messages from ViCompress. The path of the errorlog is determined by the configuration option errorlog:
By default, ViCompress logs just basic startup and shutdown messages, as well as the up/down status of backend web servers. If the
# cd /usr/local/vicompress/bin
# ./vicompress.sh debug
Log related options: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Log Statistics | The vicompress server generates HTML reports with statistics about bandwidth, caching, and compression. Every hour, it will parse the accesslog and write HTML statistics reports to the logstats directory, using the filename
where YYYY is the year, and MM is the month. For example:
This report will show the bandwidth saved with caching and compression for
A sample report for day of the week is shown below:
View a complete sample report. In addition, an HTML date index file will be created containing hyperlinks to all the monthly statistics. The statistics can also be generated independent of the vicompress server, by running update_log_stats on the command line with the following arguments: On Windows: > cd C:\Program Files\ViCompress\
> update_log_stats.exe <path to accesslog> <logstats directory> > update_log_stats.exe log\accesslog.txt logstats On Unix: # cd /usr/local/vicompress/bin/
# ./update_log_stats <path to accesslog> <logstats directory> # ./update_log_stats /usr/local/vicompress/log/accesslog /usr/local/vicompress/logstats Log Statistics related options
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
HTTP 1.1 Support | ViCompress fully supports the HTTP 1.1 standard, including the following:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
High Performance | ViCompress was designed for high performance and scalability:
|
Installing on Microsoft Windows
Installing on Linux
Installing from the source
Download the ViCompress Windows Installer vicompress-1.1.1.installer.exe from
https://www.visolve.com/vicompress/download.php
Choose which directory to install ViCompress under:
The following files will be installed:
C:\Program Files\ViCompress\LICENSE.txt | The License |
C:\Program Files\ViCompress\vicompress_manual.html | The ViCompress HTML manual |
C:\Program Files\ViCompress\update_log_stats.exe | Program to generate/update log statistics |
C:\Program Files\ViCompress\vicompress.exe | Main vicompress server |
C:\Program Files\ViCompress\vicompress.conf.txt | Configuration file |
C:\Program Files\ViCompress\errorpage.html | HTML page to send back to users on errors |
C:\Program Files\ViCompress\log\ | Directory where log files are stored |
C:\Program Files\ViCompress\logstats\ | Directory where HTML log statistics are written to |
C:\Program Files\ViCompress\logstats\template.html | Template HTML file used when generating HTML statistics reports. |
C:\Program Files\ViCompress\logstats\verticalbarN.png | Image files used in HTML statistics reports. |
C:\Program Files\ViCompress\logstats\visolvelogo.png | Image file used in HTML statistics reports. |
Visolve distributes pre-compiled packages for Ubuntu/Debian Linux, and for RedHat/Fedora Linux.>
To install the Ubuntu/Debian package, run the dpkg command:
To install the Redhat/Fedora package, run the rpm command:
To remove the ViCompress package, use the deb/rpm erase command. All ViCompress files will be removed, except for log files.
The following files will be installed:
/usr/local/vicompress/LICENSE | The License |
/usr/local/vicompress/vicompress_manual.html | The HTML documentation |
/usr/local/vicompress/bin/tune_kernel.sh | Script to tune Linux kernel parameters, for performance |
/usr/local/vicompress/bin/update_log_stats | Program to generate/update log statistics every hour |
/usr/local/vicompress/bin/update_log_stats.sh | Script to cleanly start/stop the update_log_stats program. |
/usr/local/vicompress/bin/vicompress | Main vicompress server |
/usr/local/vicompress/bin/vicompress.sh | Script to cleanly start/stop the vicompress server. |
/usr/local/vicompress/etc/vicompress.conf | Configuration file |
/usr/local/vicompress/etc/errorpage.html | HTML page to send back to users on errors |
/usr/local/vicompress/log/ | Directory where log files are stored |
/usr/local/vicompress/logstats/ | Directory where HTML log statistics are written to |
/usr/local/vicompress/logstats/template.html | Template HTML file used when generating HTML statistics reports. |
/usr/local/vicompress/logstats/verticalbarN.png | Image files used in HTML statistics reports. |
/usr/local/vicompress/logstats/visolvelogo.png | Image file used in HTML statistics reports. |
Requirements
Download the ViCompress source code from
https://www.visolve.com/vicompress/download.php
Extract the ViCompress source code, and change into the src directory.
Run the configure script, passing the directory to install ViCompress into. The default directory is /usr/local/vicompress.
If you're using a C compiler other than gcc, you will need to edit the compiler flags in the Makefile. The default flags are:
Compile the source code.
The make install command will copy the ViCompress runtimes files into the install directory (/usr/local/vicompress ).
ViCompress uses the configuration file
C:\Program Files\ViCompress\vicompress.conf.txt (Windows)
/usr/local/vicompress/etc/vicompress.conf (Unix)
One option is specified per line. Blank lines are ignored. Lines beginning with a hash (#) are ignored.
webserver |
<IP address> <port> [host1.com] [host2.com] ... |
Two example config files are shown below:
Option Examples Description |
webserver <IP address> <port> [host1.com] [host2.com] ...
ViCompress supports 3 modes of forwarding
This option is used if ViCompress is being used as a reverse proxy, as opposed to a forward proxy. Specify the IP address and port of the backend webserver to forward requests to. Multiple webserver entries may be specified, each on a separate line. Both IPv4 and IPv6 addresses are supported. If you are running multiple websites (virtual hosts) on different IP addresses/ports, then you can also specify the virtual hosts in addition to the IP address and port. Multiple virtual hosts can be specified for a single webserver entry. When ViCompress receives a request, it will parse out the hostname in the URL and find a
In the example above:
webserver entries match the request, ViCompress will load-balance among them. See the Load Balancing and Failover section for details. |
Option Examples Description |
listen <IP address> <port>
Specify the IP address and port for ViCompress to listen on. Multiple listen entries may be specified, each on a separate line. Both IPv4 and IPv6 addresses are supported. The default value is all IPv4 interfaces, 0.0.0.0, on port 80, the standard HTTP port. Only servers started by root can bind to ports less than 1024. The older (1.0.7 and earlier) configuration options |
Option Examples Description |
outgoingip <IP address>
Specify the IP address for ViCompress to bind to when making outgoing connections. Both IPv4 and IPv6 addresses are supported. The default value is any interface, 0.0.0.0. |
Option Examples Description |
enable_sessions <yes|no>
Enable or disable sticky sessions. The default value is yes. This option is only used when two or more backend webservers are specified in the ViCompress configuration. When enabled, ViCompress will use HTTP Cookies to ensure that a client is sent to the same backend web server for the duration of its session. An HTTP session lasts until the client browser is closed. See the Load Balancing and Failover section for more details. |
Option Examples Description |
enable_compression <yes|no>
Enable or disable gzip compression. The default value is yes. When enabled, ViCompress will gzip HTML and text pages before sending the response to the client. See the Compression section for details about how gzip compression is performed. |
Option Examples Description |
enable_caching <yes|no>
Enable or disable caching of pages. The default value is yes. When enabled, ViCompress will cache static pages and images in memory. These cached pages are only in memory, they are not written to disk. See the Caching section for details about what objects are cached, and for how long. |
Option Examples Description |
cache_memory <size in megabytes>
Specify the size of the in-memory cache, in megabytes. The default value is 100. Note that under high load, ViCompress will also use around 12 MB for compression and 10 MB for basic operation. The total memory (cache_memory + 22 MB) should not exceed the amount of RAM memory available. If cache_memory is set to 0, caching is disabled. |
Option Examples Description |
max_cacheditem_size <size in kilobytes>
Web pages larger than this size will not be cached. In order to have a high hit rate, ViCompress should cache many small pages, rather than a few large pages. To prevent large pages from being cached, use this option. The default value is 512 kilobytes. |
Option Examples Description |
cache_expires <hours>
When a web page is cached, it remains in the cache based on its age. The expiration time is set to half of the item's age. For example, a page that is 4 days old will be cached for 2 days. This option is used to place an upper limit on the expiration time. The default value is 240 hours (10 days). After 10 days, the page is removed from the cache. |
Option Examples Description |
enable_dns_caching <yes|no>
Enable or disable caching of dns lookups. The default value is yes. When enabled, ViCompress will store the hostname-to-IP address mappings in memory. |
Option Examples Description |
dns_expires <hours>
Specify the amount of time a cached DNS mapping is valid. The default is 2 hours. |
Option Examples Description |
user <username>
The user to run the server as. ViCompress will switch to this user after binding to the listening port (usually port 80). ViCompress is generally started as root, since only root can bind to ports less than 1024. However, it is unsafe to run a server program as root. Therefore, ViCompress will switch to a non-root user after binding to port 80. That user is specified by the "user" option given above. The default value is the user who started the server. |
Option Examples Description |
hostheader <hostname>
This option only applies when accelerating a website. It does not apply to forward proxies. Specify the hostname to use in the HTTP Host header, when sending the HTTP request to the backend webservers. By default, ViCompress will just send the same HTTP Host header it receives from the client browser. |
Option Examples Description |
accesslog <path to logfile>
Specify the file path where the access log should be stored. The file must be writable by the username given in the "user" option. If the filename contains spaces, the filename must be enclosed in quotes. If the accesslog is not specified, no access log file will be created or written to. |
Option Examples Description |
errorlog <path to logfile>
Specify the file path where the error log should be stored. The file must be writable by the username given in the "user" option. If the filename contains spaces, the filename must be enclosed in quotes. If the errorlog is not specified, no error log file will be created or written to. |
Option Examples Description |
logstats <directory>
Every hour, the vicompress server will run the update_log_stats program to generate the log statistics from the |
Option Examples Description |
errorpage <path to errorpage.html>
Specify the file path where the HTML error page is located. This HTML page will be sent back to users when ViCompress is unable to lookup or connect to the origin web server in the HTTP request. If no file is specified, then no HTML content is sent back on HTTP error replies. |
Option Examples Description |
rotatesize <size in megabytes>
Rotate the log files when they reach the specified size, in megabytes. The default value is 100. The maximum value is 2047, or about 2 gigabytes. When rotation occurs, the following commands are executed:
mv <accesslog>.1 <accesslog>.2
mv <accesslog> <accesslog>.1 and a blank log file is created at |
Option Examples Description |
logformat <apache|squid>
Specify the format of the accesslog file. The supported formats are the Apache Combined Log Format, and the Squid Access Log Format. The default value is the Squid format. A brief summary of the two formats is given below. Note that the Apache format does not include the hostname of the request URL, only the URL path. Apache Log Format clientip : The IP Address of the client. hit/compression: "hit" or "miss", followed by the length before compression. username : The username sent for authentication, or "-" if not given. date : The date of the response [day/month/year:hour:min:sec +/-timezone] firstline : The first line of the HTTP request (method url version). replycode : The server HTTP reply status code. contentlength : The reply length after compression, in bytes. referer : The URL which referred the user to this website. useragent : The platform and version of the client browser. A sample Apache log entry is shown below:
Squid Log Format date : The date of the response, the number of seconds since 1970. duration : The duration of the response, in milliseconds. client : The IP address of the client. hit status : TCP_HIT if the request is a cache hit, else TCP_MISS. replycode : The server HTTP reply status code. contentlength : The reply length after compression, in bytes. method : The HTTP request method (GET, POST, etc). URL : The requested URL. compression : The reply length before compression, in bytes. peerstatus : NONE if the request is a cache hit, else DIRECT. peerhost : The IP address of the backend web server, or "-" if a cache hit. contenttype : The content type of the HTTP reply, or "-" if not given. A sample Squid log entry is shown below:
See the Log Files section for further details. |
Option Examples Description |
enable_debug <yes|no>
Enable or disable debugging. The default value is no. When enabled, ViCompress will write debug messages to the errorlog. By default, ViCompress logs just basic startup and shutdown messages, as well as the status of backend web servers. The messages are shown below.
vicompress shutting down
vicompress started Maximum concurrent clients is <number> Cache size is <number> MB Marking webserver <ip address>:<port> as down Webserver <ip address>:<port> is now up Each debug message in the errorlog contains the date, the IP address:port of the client connection, and the debug message. Here is a sample entry: [Tue May 10 17:18:41 2005] [127.0.0.1:52689] New client accepted.
Below is the complete list of debugging messages:
New client accepted.
Read http request from client: status=<status message>, url=<urlpath> <HTTP request> Looking up IP address for hostname <hostname> Connecting to server <IP address>:<port> Re-using persistent server connection to <IP address>:<port> Read http reply from server: status=<status message> <HTTP reply> Writing server reply Writing, caching, compressing, chunk-encoding server reply Writing error reply to client Writing _viewcache_ page to client Writing cached reply to client Writing direct reply to client Wrote server reply: status=<status message> Wrote cached reply: status=<status message> Wrote direct reply: status=<status message> Wrote error reply: status=<status message> Wrote _viewcache_ page: status=<status message> Keeping client connection alive Closing connection Checking if webserver <ip address>:<port> is up Webserver <ip address>:<port> is still down For the <HTTP request> and <HTTP reply>, ViCompress will print out the full http request and reply headers. For <status message>, ViCompress will print out one of the messages below:
Success
Bad HTTP Request from client Bad HTTP Reply from server Client closed prematurely Server closed prematurely Connect failed Error reading from client Error writing to client Error reading from server Error writing to server DNS lookup failed Below is a sample debug log session for a non-cached request, that is being compressed
New client accepted.
Read http request from client: status=Success, url=visolve.com/path/index.html GET /path/index.html HTTP/1.1 Date: Wed, 30 Oct 2002 12:43:03 GMT Accept-Encoding: gzip Host: visolve.com Connection: Keep-Alive Connecting to server 76.212.18.41:80 Read http reply from server: status=Success HTTP/1.1 200 OK Date: Wed, 30 Oct 2002 12:43:03 GMT Server: Apache/2.0.54 (Fedora) Content-Type: text/html; charset=iso-8859-1 Connection: Keep-Alive Writing, compressing, chunk-encoding server reply Wrote server reply: status=Success Keeping client connection alive
|
Main configuration options
Running ViCompress on Microsoft Windows
Running ViCompress on Linux/Unix
Before starting ViCompress, the two main configuration options to set are the listen
and webserver
options.
The ViCompress configuration file is located at:
C:\Program Files\ViCompress\vicompress.conf.txt (Windows)
/usr/local/vicompress/etc/vicompress.conf (Unix)
The listen
option specifies the address and port to listen on.
listen <IP address> <port>
For example
listen 192.10.10.5 80
If ViCompress is being used as a forward proxy, then no webserver
entries are needed. However, if ViCompress is being used as