The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How does cPanel calculate bandwidth usage?

Discussion in 'General Discussion' started by beem, Nov 28, 2008.

  1. beem

    beem Member

    Joined:
    Nov 28, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I have tried to optimize my webpage to use as little bandwidth as possible.

    To do this:
    1) I moved most of the images to another server and redirected all the references using .htaccess (RewriteRule and [R=301,L])
    2) To block nasty leechers I have routed all the other static files through a special getfile.php script that uses my mysql database to keep track of a traffic from each IP and blocks IPs that abuse their bandwidth. Otherwise just returns the file using php's readfile() function.

    The problem is that instead of decreasing the bandwidth... I doubled it. :confused:

    How is it possible?

    How does cPanel calculate the used bandwidth?
    I've tried to find this info in the documentation, but without any success.

    1) Is it possible that after moving images to a different server and redirecting them via .htaccess the bandwidth usage would increase?
    2) Does cPanel'c bandwidth calculator also count the data sent to/from the database?
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,446
    Likes Received:
    195
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Have you taken a close look at your awstats for any signs as to what's getting the most traffic?
     
  3. beem

    beem Member

    Joined:
    Nov 28, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    That is actuall another issue: a big difference between awstats and cpanel.

    E.g. for yestarday, awstats shows:
    27 Nov 2008 | 4061 | 29133 | 100191 | 531.83 MB
    And cpanel's bandwidth screen:
    27 | 1414.26 | 1413.75 | 0.00 | 0.51 | 0.00 | 0.00

    As you see there is a difference of over 800MB between awstats and cpanel.
    Before I added this "optimizations" the difference was smaller, but still significant.
     
  4. beem

    beem Member

    Joined:
    Nov 28, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Maybe I shoudl add that I use:
    cPanel Version 11.23.6-RELEASE
    cPanel Build 27698


    I have just created a test subdomain with a script that fetches some amount of data from the database and returns empty page.
    Maybe cPanel charges me for DB communication... I will know it as soon as my stats are updated.

    In the meantime if anyone could please give me some advise where my hidden bandwidth may come from, I would really appreciate it.
     
  5. rrwh

    rrwh Well-Known Member

    Joined:
    Oct 2, 2004
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    AWStats only tells you about web traffic.

    CPanel takes into account all traffic to your account - and includes email, cpanel traffic - including you looking at your AWStats! ftp traffic etc, etc,etc.

    If Cpanel and AWStats were equal, then I would really start to worry!
     
  6. beem

    beem Member

    Joined:
    Nov 28, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Cheers!

    First of all - I proved my theory was wrong; database traffic does not count in.

    In CPanel, on the Bandwidth page under "Bandwidth Transfer Detail" I have "Bandwidth By Day" and there I can clearly see that HTTP Traffic reported for the past 2 days is by over 800MB bigger than reported by Awstats for the same days.

    May it be because some of the visitors use direct IP address instead of the domain name to access the webpage?
     
  7. beem

    beem Member

    Joined:
    Nov 28, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I think I figured out already where does this additional bandwidth come from.

    Some bastard is leeching my bandwidth by doing huge POST-s to the webserver.
    Awstats does not count it in, but CPanel adds these incoming data to my bill :mad:

    Any idea how I could prevent this from happening?
     
  8. Freezer

    Freezer Well-Known Member

    Joined:
    Jun 13, 2005
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Den Haag
    cPanel doesn't count a lot of bandwidth... see me sig.

    You can block the ip in your firewall but there arn't much of options to do else.
     
  9. stdout

    stdout Well-Known Member

    Joined:
    Apr 10, 2003
    Messages:
    189
    Likes Received:
    5
    Trophy Points:
    18
    Location:
    Nelspruit, Mpumalanga, South Africa
    cPanel Access Level:
    Root Administrator
    To my knowledge FTP bandwidth is counted (maybe not accurately).
    Check out /var/cpanel/bandwidth/
     
  10. Freezer

    Freezer Well-Known Member

    Joined:
    Jun 13, 2005
    Messages:
    120
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Den Haag
    Yes that would you think, but it's not. Transfer a large amount from/down your ftp and see what is happening. I had a user who transferred 100gb a month through his ftp account, and cpanel counted nothing. On my other server i was able to reproduce this also. Their explaination: it's working as designed...
     
Loading...

Share This Page