tags:

views:

43

answers:

2

This could be very basic type of question for you! But for me it is very important. 1) How these(orkut, facebook or other) website store the images in server?

Options: a) Keeping all the images in database by converting into bytecode/binary. b) Making a new folder for each user and saving photographs according to their library name. c) Or something else which i(Anup) didn't guess yet.

Please reply me.

Sayiing thanx to see my question and any many many thanx for answering my question.

+2  A: 

The definitely store the images as binaries to disk. To store them in a database would create unnecessary overhead. I've heard that some large image hosters stores many images in the same file and a byte offset in the database, so the server can keep the storage files open and just seek in them to obtain other images. This will save you from open and close calls to the kernel.

Emil Vikström
+3  A: 

a) There is no converting into byte code/binary code, the image is binary date and is simply and directly stored as it is in the DB. This is definitely not the best way to save pictures, because every request for a picture involves the DB, Web servers are faster serving static content directly.

b) this is slightly better, but for privacy reasons you should make sure that it is impossible to browse your images

c) The Facebook way: Facebook uses a Content Distribution Network (CDN) to store the pictures of its users, so if a browser requests a specific picture it loads from a server that is the nearest to himself. The Picture is distributed to multiple servers allotted all over the world. The same goes for youtube and video files.

jigfox