SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello all,

    This is a fairly general question, but one that has me a bit confused. Recently I've noticed HUGE spikes in bandwidth transferred from my server right after we converted all pages to php and installed a mySQL database.

    We were doing about 8-9 Gb a month with static HTML files, and now do close to 1Gb a day! Logs show, this increase started after we switched the site to php/mySQL.

    I realize the design/coding could be flawed and this could be the reason for the bandwith spike - BUT - first impressions don't seem to indicate this. The website was designed by a 3rd part web-developer and we recently had the site checked for weird or inefficient code and everything seemed fairly "normal" i.e. SELECT statements used correctly instead of transferring entire database over the wire etc.! Basically, nothing seems to indicate that we have been TRANSFERRING useless, unneeded information to cause the bandwidth increase.

    Obviously we are getting billed for the extra bandwidth that we are consuming, and since it isn't due to an increase in traffic, the "top order" is understandably demanding answers as to why this "new" technology is costing us more!

    Does using PHP/mySQL mean that there will definitely be an increase in bandwidth? Will it be as much as I mentioned above???!!! Additionally, I realize PHP is a server-side scripting language, and hence all computations are done on the server (processor, memory usage), but then the information is encapsulated and sent back to the visitor as HTTP traffic (Correct?)
    WEIRD THING is that the HTTP bandwidth for the month is in check i.e. below 10Gb... BUT the TOTAL bandwidth on the server is close to 35Gb for the month! (And no, CGI scripts, emails, FTP are not responsible for this spike).

    Any ideas...anyone?

    Thanks a bunch. Hope some of the php/mySQL gurus and proponents of this technology can answer these questions.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First thing that comes to mind is, are you parsing all pages for php or are there some static html pages? If the whole site is dynamic, you may see some increase in bandwidth, but first thing that popped into my mind is, if the server is set to parse all files as php and not just pages with certian extensions such as .php or .php3, this could lead into a huge increase in bandwith. So in essence if the server is parsing file for php even .htm and .html files then this might cause the extra bandwidth you mentioned.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Zeeshan,
    I think you're getting transfer and bandwidth mixed up. Bandwidth is how much a connection can download and/or upload in a given time frame (like 10MB per second). Transfer is how much that connection can or did transfer in a given time frame (usually a month). You'll see most hosts get that mixed up too, so don't worry...

    But I don't see how using PHP could be increasing bandwidth. The PHP interpreter doesn't use any bandwidth at all. One of the only situations in which it might increase bandwidth is when you're connecting to a remote mySQL server. But that server had better be on the same LAN as your web server or you're in trouble...

    If you have a web stat program, then see which file is taking up the most bandwidth. I'm really confused about this, because PHP and MySQL shouldn't be taking up 3 times as much bandwidth as plain HTML files did.

    Parsing all files for PHP would certainly increase the CPU load but it wouldn't do anything to the bandwidth.

    The other situation I can think of in which PHP+mySQL would increase bandwidth usage is cached content. Again, if you have a web stat program, then see how many times your web server returns 304, which means "The file you requested has not been modified since the date in your If-Modified-Since header."

    I'd be interested to see the results...hope this helps.

  4. #4
    code addict Abstraction's Avatar
    Join Date
    Apr 2001
    Location
    Des Moines, IA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So where is the other 25 Gb a month coming from?

  5. #5
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot for the information guys.

    Qslack: Yes, my fault! I did get the bandwidth and transfer/month mixed up. So to restate: Before the shift to php/mySQL we were doing about 10Gb a month of transfer. After the shift, we noticed approx. 1Gb a DAY of data transfer from the server.

    Also, I'm quite sure the mySQL database is on the same machine - albeit same LAN - as the site itself. So in essence, any calls to the database from the php files are getting resolved and computed "locally" at the server and the results are getting thrown back.

    Freddy: No, the server is still set to a regular web server i.e. it only parses .php files as php and works with static HTML files as it did before.

    I have gotten in touch with the web-host company to do some research on this, and hopefully they will be able to narrow down on the problem. In the meantime I shall go through the server logs to search for files that are consuming the most bandwidth etc.

    Again, appreciate the help from you guys.

  6. #6
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Abstraction:
    That's what I can't figure out!

    The web controlpanel they have provided us only tracks HTTP traffic for that DOMAIN. But I know for sure that we are not using FTP, email or CGI scripts anywhere close to what would constitute a 25Gb data transfer!

    Again, I have asked the web-host to look into this.

  7. #7
    SitePoint Guru DenverDave's Avatar
    Join Date
    Feb 2001
    Location
    Denver, Colorado
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have used the freeware product Analog from http://www.statslab.cam.ac.uk/~sret1/analog/ this pretty well ties down the transfer usage to the file served. I assume other products do the same.

    Dave


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •