I was just wondering. If one were to provide a basic free counter service (no tracking, etc.) - something like digits.com minus the paid option, what will be the kind of bandwidth required to cater about a million visitors? And, this Tim Boutell's GD library. Is that to reduce the bandwidth or to speed up the process in the server? Stan.
Just take a look at the size of some images provided by those free counter services: an image size between 1 and 2KB is probably reasonable, so that would be at least somewhere between 1 and 2GB for a million visitors.
And BTW the GD library is not that good for high traffic apps, as it uses a lot of memory. The imagemagick library is much better, but it is more difficult to use.
No, that will be for a million requests. A million users having an average of 1000 hits a month, if each image is only 2 KB, 2000 GB per month bandwidth. But, isn't that too high? So, they do it like this only, and not any other technique which might reduce the bandwidth to say 100 MB per month?
You also need a good server that can handle the load and MySQL queries. In fact if you're serious about the traffic levels you plan to support I'd suggest a dual server solution with one web and one database server.
Okay. But apart from all the secondary issues, is there a way to reduce the bandwidth per se? That is, for one visit, instead of say 2 KB, something like 1/10th of a KB?
Depending on what image you want to show, I could fit 7 digits into a 50 x 12 pixels image saved as a GIF with 2 colors for a total of 112 bytes.
kajakske, that is cool. Using PHP? So, if I have a script like CounterCode, you would be able to modify it and do it like that? Like the counter on this page? fridayharborirish.com Thnks, Stan.
The counter on that site is 400 bytes, which isn't that bad considering the size is bigger than the one I tested with. Some key points to keep in mind: When you save your image as a GIF, keep it to 2 colors. This is because GIF images save the palette of colors they use inside the image. 2 colors = smallest you can go (transparent is considered a color too). Keep it as small as possible. (width / height I mean). If your counter fits in an image 60 x 12 pixels, it will be smaller than the same counter using a bigger fontsize in a 80 x 14 image for example (hence why your example is somewhat bigger than my test). Wheter you make the image with PHP's GD library or any other one will not have any impact on the bandwith they will be using (as long as they are saved optimally). If you really insist on a better looking counter, say a JPEG with a small logo and then the numbers, you will have a considerable amount of increased bandwith compaired to a small GIF one ...
Thanks kajakske, Let us say I offer many choices for the user to pick. Like digits.com/thumbnail/ And, on average a visitor picks a Interlaced GIF with width 300 px and height 30 px. But, this average size is 5 KB as on that site. Try, for example, digits.com/thumbnail/wc-06-3.gif That makes it a 5TB in bandwidth for a million visitors averaging 1000 hits a month. Is there a way to get the same quality of image with a lesser size, like a 1 KB?
Defenetly ! The example you gave me is a GIF with 256 colors in its palette ... Saving the same image as a JPG with 30% quality could save you 50% bandwith. http://www.hawkfield.be/temp/wc-06-3.jpg I just opened your image and saved it as a JPG in Photoshop, but you can do the same in PHP with the imagejpeg() function (the third parameter is the quality). Basically (not always, you have to test) an image with very little colors is smaller in GIF format, an image with alot of colors is smaller in JPG ...
Well, I get that logic, but I am zero in programming. I just want to know if all this creation and compression (jpeg or reduced colors gif) can be done on the fly so fast as to serve, say, maybe 50 users in one second? Thanks, Stan.
Hmm, I have absolutly no idea :-( The GD library isn't that fast I heard, but I wouldn't be able to tell you... How is the file created now ? If it is a static GIF (like the one you showed me) it can just be optimised once with PhotoShop.
ImageMagick is not difficult to use at all. Just look through imagemagick . com and you'll understand it. And if you need to process a lot of graphical operations for high traffic you really can't do it without ImageMagick. And when you'll be choosing a hosting for your site check the ImageMagick availability there, because it's necessary. Regards, Denis