473,738 Members | 10,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A BILLION pictures...how do they do it?

I am writing my own family photo sharing site that I hope to take
public (like so many others). Anyway, currently, when the user
uploads a picture, I store the picture outside my htdocs folder and
record the image details in a MySQB db. When you browse the picture,
I read the record and build the image by sending an image/jpeg header.

Seems to work but I am a little disappointed with performance.
Granted I am running on a really old machine which might be the
reason. lol

Seriously though, if I take this public and get extremely lucky and
millions of photos are uploaded, would this be the best method?

I've read pros and cons of storing images in a database. I've read
about Flickr, SmugMug, Photobucket having HUNDREDS of millions to over
a BILLION images stored!

Obviously, load balancing plays into this but what other secrets do
you think they use?

One thing I worry about is my file system. I have something like:

pix
-----user1
-------------thumbs
-----user2
-------------thumbs

etc...

Any pointers would be appreciated.
Thanks

cbmeeks

Jun 12 '07 #1
8 1561
cbmeeks wrote:
I am writing my own family photo sharing site that I hope to take
public (like so many others). Anyway, currently, when the user
uploads a picture, I store the picture outside my htdocs folder and
record the image details in a MySQB db. When you browse the picture,
I read the record and build the image by sending an image/jpeg header.

Seems to work but I am a little disappointed with performance.
Granted I am running on a really old machine which might be the
reason. lol

Seriously though, if I take this public and get extremely lucky and
millions of photos are uploaded, would this be the best method?

I've read pros and cons of storing images in a database. I've read
about Flickr, SmugMug, Photobucket having HUNDREDS of millions to over
a BILLION images stored!

Obviously, load balancing plays into this but what other secrets do
you think they use?

One thing I worry about is my file system. I have something like:

pix
-----user1
-------------thumbs
-----user2
-------------thumbs

etc...

Any pointers would be appreciated.
Thanks

cbmeeks
First of all, you should be asking this in a database newsgroup, not a
PHP one. And preferably a newsgroup aimed at the database you're using.

I store pictures in databases. It works quite well. Takes some tuning,
but I find it provides good performance.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 12 '07 #2
First of all, you should be asking this in a database newsgroup, not a
PHP one. And preferably a newsgroup aimed at the database you're using.
Well, that's assuming I would only use MySQL and not PHP to serve my
files. :-)
I store pictures in databases. It works quite well. Takes some tuning,
but I find it provides good performance.
Yeah, I'm not surprised you replied. I have been reading some of your
posts about images in db's. You really have me thinking about images
in db's. I have to admit, I am walking on top of the fence and could
jump to either side when it comes to file system/db for storing
images. I agree with your postings about actually doing it instead of
quoting theories.

Scalability is very important but it's not the only thing.
Portability is also important. I am thinking of using Amazon's S3
(which I believe is a flat file system). But the bad thing about
using Amazon is that I put all of my eggs in one basket. They just
recently had a price change that made a lot of people happy but not
all...point is, they did that because they can.

I would love to be the fly on the wall at Amazon, eBay, Google, etc
and see how they store images. I know Google has their BigTable.

I guess I should follow by example. SmugMug uses their own internal
system that is helped along with S3. But I have no idea of how much
they serve from S3 or if they just use S3 as a backup.

Oh well, sorry for the rambling.

cbmeeks
http://www.eblarg.com

Jun 12 '07 #3
On Jun 12, 5:09 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
cbmeeks wrote:
I am writing my own family photo sharing site that I hope to take
public (like so many others). Anyway, currently, when the user
uploads a picture, I store the picture outside my htdocs folder and
record the image details in a MySQB db. When you browse the picture,
I read the record and build the image by sending an image/jpeg header.
Seems to work but I am a little disappointed with performance.
Granted I am running on a really old machine which might be the
reason. lol
Seriously though, if I take this public and get extremely lucky and
millions of photos are uploaded, would this be the best method?
I've read pros and cons of storing images in a database. I've read
about Flickr, SmugMug, Photobucket having HUNDREDS of millions to over
a BILLION images stored!
Obviously, load balancing plays into this but what other secrets do
you think they use?
One thing I worry about is my file system. I have something like:
pix
-----user1
-------------thumbs
-----user2
-------------thumbs
etc...
Any pointers would be appreciated.
Thanks
cbmeeks

First of all, you should be asking this in a database newsgroup, not a
PHP one. And preferably a newsgroup aimed at the database you're using.

I store pictures in databases. It works quite well. Takes some tuning,
but I find it provides good performance.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
You should read the Database DOCS. In case of MySQL, if you index your
table and use the right mysql database type, then you will get more
perfomance with storing images in the database.
Also if you run a very huge site, your database server's will run on
SCSI machine's which means that you have often faster Database
Harddrive's then your webserver.

Jun 12 '07 #4
cbmeeks wrote:
>First of all, you should be asking this in a database newsgroup, not a
PHP one. And preferably a newsgroup aimed at the database you're using.

Well, that's assuming I would only use MySQL and not PHP to serve my
files. :-)
>I store pictures in databases. It works quite well. Takes some tuning,
but I find it provides good performance.

Yeah, I'm not surprised you replied. I have been reading some of your
posts about images in db's. You really have me thinking about images
in db's. I have to admit, I am walking on top of the fence and could
jump to either side when it comes to file system/db for storing
images. I agree with your postings about actually doing it instead of
quoting theories.

Scalability is very important but it's not the only thing.
Portability is also important. I am thinking of using Amazon's S3
(which I believe is a flat file system). But the bad thing about
using Amazon is that I put all of my eggs in one basket. They just
recently had a price change that made a lot of people happy but not
all...point is, they did that because they can.

I would love to be the fly on the wall at Amazon, eBay, Google, etc
and see how they store images. I know Google has their BigTable.

I guess I should follow by example. SmugMug uses their own internal
system that is helped along with S3. But I have no idea of how much
they serve from S3 or if they just use S3 as a backup.

Oh well, sorry for the rambling.

cbmeeks
http://www.eblarg.com
Either way you're going to have to use PHP (or PERL or some language) to
serve the images up. But the database design and configuration is the
more important thing here. That's why I suggested a database newsgroup.
It's a better place to discuss these things.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 12 '07 #5
Max/Jerry:

Oh believe me, I would like to use the DB and I will certainly try it
and run some performance testing.

serve the images up. But the database design and configuration is the
more important thing here. That's why I suggested a database newsgroup.
It's a better place to discuss these things.
Agreed. I just don't like to cross post and I knew that PHP and MySQL
would be involved. That's why I started here first.

Jun 12 '07 #6
NC
On Jun 12, 5:27 am, cbmeeks <cbme...@gmail. comwrote:
>
I am writing my own family photo sharing site that
I hope to take public (like so many others). Anyway,
currently, when the user uploads a picture, I store
the picture outside my htdocs folder and record the
image details in a MySQB db. When you browse the
picture, I read the record and build the image by
sending an image/jpeg header.

Seriously though, if I take this public and get
extremely lucky and millions of photos are uploaded,
would this be the best method?

I've read pros and cons of storing images in a database.
I've read about Flickr, SmugMug, Photobucket having
HUNDREDS of millions to over a BILLION images stored!

Obviously, load balancing plays into this but what
other secrets do you think they use?
Separating (static) pictures from other (dynamic) content. Say, you
have two servers, one with PHP/MySQL (let's call it www.yoursite.com),
another with nothing but Apache (content.yoursi te.com), optimized for
serving static images. The application residing on www.yoursite.com
saves images onto content.yoursit e.com and records their full URLs
(http://content.yoursite.com/path/file.jpg) in its database. When
content.yoursit e.com gets low on available disk space, you put up a
new server (content2.yours ite.com) for writing and start filling it up
with pictures, while content.yoursit e.com still remains accessible for
reading. You can continue to add new content*.yoursi te.com servers as
you go. Dynamically generated HTML gets served from www.yoursite.com
(which may eventually outgrow a single server and morph into a server
cluster), static images, from content*.yoursi te.com.

A slight variation of this approach is that multiple servers are open
for writing at any given time; images are written onto a randomly
chosen server. This helps ensure that highly popular content will be
spread between multiple servers and can thus be served faster.

Yet another possibility is to hide your application behind a layer of
caching proxies...
One thing I worry about is my file system. I have
something like:

pix
-----user1
-------------thumbs
-----user2
-------------thumbs
There's absolutely no need for the file structure to replicate your
database structure...

Cheers,
NC

Jun 12 '07 #7
cbmeeks wrote:
Max/Jerry:

Oh believe me, I would like to use the DB and I will certainly try it
and run some performance testing.

>serve the images up. But the database design and configuration is the
more important thing here. That's why I suggested a database newsgroup.
It's a better place to discuss these things.

Agreed. I just don't like to cross post and I knew that PHP and MySQL
would be involved. That's why I started here first.
Ah, but cross-posting is the ONLY way to fly! :-)

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 12 '07 #8
That makes sense. I see many of the big sites use
"static123.exam ple.com".


On Jun 12, 1:52 pm, NC <n...@iname.com wrote:
On Jun 12, 5:27 am, cbmeeks <cbme...@gmail. comwrote:


I am writing my own family photo sharing site that
I hope to take public (like so many others). Anyway,
currently, when the user uploads a picture, I store
the picture outside my htdocs folder and record the
image details in a MySQB db. When you browse the
picture, I read the record and build the image by
sending an image/jpeg header.
Seriously though, if I take this public and get
extremely lucky and millions of photos are uploaded,
would this be the best method?
I've read pros and cons of storing images in a database.
I've read about Flickr, SmugMug, Photobucket having
HUNDREDS of millions to over a BILLION images stored!
Obviously, load balancing plays into this but what
other secrets do you think they use?

Separating (static) pictures from other (dynamic) content. Say, you
have two servers, one with PHP/MySQL (let's call itwww.yoursite. com),
another with nothing but Apache (content.yoursi te.com), optimized for
serving static images. The application residing onwww.yoursite. com
saves images onto content.yoursit e.com and records their full URLs
(http://content.yoursite.com/path/file.jpg) in its database. When
content.yoursit e.com gets low on available disk space, you put up a
new server (content2.yours ite.com) for writing and start filling it up
with pictures, while content.yoursit e.com still remains accessible for
reading. You can continue to add new content*.yoursi te.com servers as
you go. Dynamically generated HTML gets served fromwww.yoursit e.com
(which may eventually outgrow a single server and morph into a server
cluster), static images, from content*.yoursi te.com.

A slight variation of this approach is that multiple servers are open
for writing at any given time; images are written onto a randomly
chosen server. This helps ensure that highly popular content will be
spread between multiple servers and can thus be served faster.

Yet another possibility is to hide your application behind a layer of
caching proxies...
One thing I worry about is my file system. I have
something like:
pix
-----user1
-------------thumbs
-----user2
-------------thumbs

There's absolutely no need for the file structure to replicate your
database structure...

Cheers,
NC

Jun 18 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
4330
by: asj | last post by:
awhile back, eBay decided to switch from a Microsoft/.NET/Windows architecture on the backend to a J2EE one, which might explain why their java backend will handle up to 1 BILLION page views a day! the funny thing was eBay was one of the major case studies for .NET at the beginning, when there was still some hype about it. interesting post about a few java case studies: http://weblogs.java.net/pub/wlg/268 "I love looking through case...
0
2030
by: JakeC | last post by:
Hey all, I'm currently redesigning a website that a friend and I started about a year ago. It is a daily surf report so when choosing the best script/language to use for the new design, I found that a mixture of PHP and MySQL would be a good idea. I have currently set up OmniHTTPd and installed MySQL and PHP onto my homeserver. I want the site to be set up as follows: 1- I add the report, date and pictures (and amount of pictures...
34
2412
by: Justin Timberlake | last post by:
I was thinking about all those /Indian Outsourcing/ companies getting those .Net shops set up. 0. Nobody uses .NET in the real world, it's all java. 1. MSFT is about to collapse as witnessed by Bill Gate$ selling his stock in droves. 2. Linux marketshare is eating up windos. So when all is said and done, the wogs won't have much left for them, will they?
12
20932
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database contains the paths to the pictures. The database consists of two tables: TABLE DATA ID Name LastName
13
2198
by: gooze | last post by:
Hello I am working on an applicaion that shows several pictures on a webpage. These pictures are saved in a MySQL DB as BLOB. I noticed, that the web server suffers in its performance by printing the pictures. Let's say there are 20 pictures to show, there also are 20 queries to do. This is the way I am doing it up to now: index.php <?php
13
3275
by: Jim Carlock | last post by:
I have over a hundred pictures I would like to present. Is it practical to create and parse an array of pictures, picture paths, et al using server-side scripting to accomplish this? I created an array already, and whereby, the HTML and Javascript currently used amount to about 14KB for each of four different pages, the PHP page I started working on is already over 35KB in size (most of it is server side processing creating the array...
25
4367
by: Subra | last post by:
Hi, What is the best way to find the 1000 largest numbers from the file having hell lot of entries ? Can you please help me to find out the way ? Do I need to go for B+ trees ?? Please help, Subramanya M
0
1510
by: eBob.com | last post by:
Here's how I insert and size pictures in an Excel spreadsheet which I create via a VB.NET program (commentary follows): 'add thumb nail objSheet.Rows(XLRow.ToString).rowheight = mpThumbNailHeight / 7 objSheet.Range("S" & XLRow.ToString).Select() objSheet.Pictures.insert(mpThumbNailLoc) 'size thumb nail - because they often end up different sizes although they all
18
4599
by: raylopez99 | last post by:
The maximum int for an array on my machine (a Pentium IV with 2 GB RAM) is < 330 Million...before you get an "out of memory" exception. I simply filled an array of this size with ints...I got as far as 320 M. So, myArray is a big as I can get. In theory a 32 bit int is 2.1 billion, but in practice, you cannot fill an array having anywhere near that number of elements. I suspect that it's because every element of an array takes up space...
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.