Often, when users compare bandwidth usage statistics that log analysis programs provide (for example, AWStats, Analog, Logaholic, and Webalizer) to bandwidth statistics that cPanel & WHM provide, they are surprised to find apparent discrepancies.
These apparent discrepancies result from the way in which different programs measure bandwidth.
The purpose of this document is to explain the differences in measurement methods. Our goal is to help web hosting providers and website owners understand how to obtain the most accurate bandwidth report.
Where to find bandwidth data in cPanel & WHM
Bandwidth data in cPanel & WHM comes from a combination of summary files and databases.
Summary file data
The following cPanel & WHM interfaces display (mainly numeric) bandwidth usage information in summary files:
The same bandwidth monitoring tool generates all of the information in these interfaces.
In contrast, AWStats, Analog, and Webalizer use a different method to process bandwidth. This is why it sometimes appears that there is no correlation between the data that the bandwidth usage information interfaces show and the data that AWStats, Analog, and Webalizer show.
Databases generate the following bandwidth graphs in cPanel's Bandwidth interface (cPanel >> Home >> Metrics >> Bandwidth):
- Past 24 hours
- Past week
- Past year
The system uses a different method to calculate these graphs than it does to calculate summary file data.
What causes the discrepancies?
Differences in measuring daily bandwidth statistics
The information that cPanel & WHM presents may differ from the day's usage in log processing programs, such as AWStats, Analog, or Webalizer. There are three possible reasons for this:
- The server administrator can set log processing and bandwidth processing cycles independently. This means that the system may generate the two statistics several hours apart, in which case, they may vary widely.
- Even if the server administrator attempts to synchronize log and bandwidth processing cycles, the system always processes the statistics at least eight minutes apart.
- The system holds the usage data for the five minutes prior to processing time until the next processing cycle. Therefore, those statistics appear in a later report.
Daily bandwidth usage numbers are far too volatile for the bandwidth and log processing results to match.
Overall differences in measuring bandwidth
There are further differences between the methods that log programs and cPanel & WHM use to process bandwidth usage.
How log processing programs measure bandwidth
Log processing programs extract the amount of bytes that the Apache combined access log transfers. The Apache combined access log records incoming data requests, which includes the size of the requested file, in bytes.
- This size only includes the full size of the content of the requested file. It does not reflect the actual number of bytes that the system transferred.
- This size measures the content of the file only. It does not include the size of the headers of the response.
- This size does not include the size of the request.
Log processing programs measure bandwidth by the size of the data that visitors requested, not the amount the data that the system actually transferred.
How cPanel & WHM measures bandwidth
To measure bandwidth, cPanel & WHM combines the amount of bytes of an incoming data request with the outgoing transferred data (the response to that request). cPanel & WHM obtains this data from the Apache logs.
These logs include the following amounts of bandwidth:
- The total bandwidth that the incoming request that solicited the content used.
- The total bandwidth that the complete response used (the sum of the size of the content plus the header).
How this affects the results
For most websites, these differences are relatively small. The headers are a few hundred bytes; the request itself is usually much less. Given reasonably sized output content, this overhead works out to a few percentage points' difference.
Certain types of request and response combinations, however, cause these differences to make a significant impact on the bandwidth measurement:
- Large numbers of non-success responses — Because redirects and errors have virtually no content, and mainly contain headers, the bandwidth usage that the log processing programs report is much smaller than the bandwidth usage that cPanel & WHM reports.
- Large numbers of very small responses — For transferred content that is smaller than 1 KB, the log processing programs report less bandwidth usage than cPanel & WHM reports. This is because the combined size of the response headers and the request is often larger than 1 KB.
- Large requests that the user cancelled — To measure bandwidth, log processing programs show the size of the requested data, not the amount the data that the system actually transferred. This means that these programs do not make a distinction between completed and cancelled requests. Therefore, a high number of requests that users cancelled may cause cPanel & WHM to report a substantially smaller amount of bandwidth usage than log processing programs report.
- This situation often occurs with sites that serve a large number of video or audio streaming requests.
- For example, 100 people request a 1 GB video, but cancel the request after only 10% of the video has downloaded. cPanel & WHM would report that the system transferred less than 10 GB of data. However, because of how they obtain their information, the log processing programs would report that the system transferred 100 GB.
Which report should I use?
We strongly recommend that you use the complete bandwidth measurement that cPanel & WHM provides. For example, use cPanel's Bandwidth interface (cPanel >> Home >> Metrics >> Bandwidth) or WHM's View Bandwidth Usage interface (WHM >> Home >> Account Information >> View Bandwidth Usage).
- Log analysis programs, while not as accurate, are useful for information about page view statistics, referrals, and other information.
- Set bandwidth processing cycles in WHM's Statistics Software Configuration interface (WHM >> Home >> Server Configuration >> Statistics Software Configuration). This interface allows you to balance server performance with latency reports, and provides the most accurate bandwidth usage statistics possible.
- For up-to-date usage information, process an individual user's statistics on demand in WHM's Statistics Software Configuration interface (WHM >> Home >> Server Configuration >> Statistics Software Configuration), in the Process Statistics for User section.