Dreamsite Overview | Creating Your Own Ebay | Client Server Communication | Website Security

Digitalfire Dreamsite Web Site Architects Logo
How do sites like Ebay and Facebook work? How can it keep track of so many people and listings? How can a server be so fast?

Creating Your Own Ebay

The fact is Ebay does not maintain millions of pages. They maintain millions of users and listings. The site manages the pages automatically. But how? You are likely used to making pages using a web page editor like Microsoft Frontpage or Macromedia Dream Weaver. You can well appreciate then that there is no way ebay.com can make millions of pages that way! Sites like Ebay and Amazon are actually huge computer programs that know now to talk to web browsers on the front end and to an SQL database server on the back end. They may have only a few dozen hand-edited pages? Let's look at an example.

Logging into Ebay

To sell an item on Ebay you must click My Ebay to log in so it knows who you are (on log in it looks up your account information in a database and of course makes sure your credit card number is current so you can pay the listing fee). Ebay remembers who you are as you navigate through it by using cookies. When you first log in it asks your browser to write a cookie onto your computer (cookies are variables with a name and value). Suppose you are ebay account number 123456. Ebay might thus ask your browser to write a cookie named "ebayaccount" and give it a value of 123456 for Ebay.com. Every time you display a new page on Ebay your browser checks to see if it has any ebay cookies and it sends them with the next page request. Ebay then looks up your account information and accordingly shapes the way it displays the requested page. It is as simple as that.

If you are a dreamer surely you can see huge potential in this simple mechanism built into every browser! Ebay designers realized at one point that since the server knows the email address of everyone who is logged on it would be possible to create a messaging system that easily enables buyers and sellers to talk to each other. At some point they also realized that it would be possible to collect feedback and create a seller and buyer rating system. These are the dreamers that shaped what Ebay is today.

Selling an Item on Ebay

When you click 'Sell' Ebay displays page 1 of a series of pages that enable you describe the item. Before it displays page one it creates an empty record in the Sales table in its SQL database system and links this to your account. When you click to go to step 2 the information you have entered thus far is written into the table in the database. This continues until the last confirmation step when you either abort or list the item. At that point Ebay either erases the record or finalizes it in and schedules it for listing. Each page in the process of describing the item contains program code that is stripped out by the server and executed before the page is sent to your browser. This code analyzes what you have entered and decides whether to redisplay the same page or go to the next one. It also generates error, status and suggestion messages and weaves them into the page that is being sent. The program code knows how to talk to the database and it knows how to analyze what was filled into the form on the page. Your browser has no idea that code was executed to shape the content of the page before it gets it.

Actually I lied a little. One remarkable thing you might notice about listing an item on Ebay is that as you proceed from page to page when listing an item the URL on the address line of your browser does not change? For example, it might be:

http://cgi5.ebay.com/ebaymotors/ws/eBayISAPI.dll

This is the name of a program on the Ebay server that is actually generating the pages of the listing process, they do not actually exist as HTML pages. Your browser asks for a page and the Ebay server makes one and sends it, simple as that. On sites like Ebay the only pages that are actually stored as html files on their server are the general information pages.

While it takes more effort to write programs that generate web pages, the huge advantage is that your server can generate millions of pages with no problem. Another advantage is that if you make a change to the program code, all pages subsequently generated reflect that change immediately. The PHP language is a great way to do this because it straddles both worlds. The web page exists as a file as if you had created it in a program like FrontPage, but it has program code interwoven into it. Thus the same page can display itself differently depending on who is looking at it or what they are doing.

Finding an Item on Ebay

When you search for an item on Ebay the page that is returned has a URL that looks like this:

http://motors.search.ebay.com/?from=R40&satitle=chain+saw

You can actually click on the above item and Ebay will display listings for chain saws. But this is not a request to the Ebay server for a web page, it is a request for listings for chain saws. Two pieces of information are given (they are separated by the & symbol):

 from: R40
 satitle: chain saw

I do not know what the R40 is but obviously the Ebay server interprets 'satitle' as the searched for phrase. The bottom line is that Ebay generates a one-time page specifically for this. It has a header with a banner that is generating revenue for Ebay and a content area where it shows the first 20 items. There are an infinite number of different searches that can be made and thus an infinite number of pages can be displayed. Also as items are sold, expire and listings are added the above URL will produce different results. In addition the page itself has many controls to shape the way the next one will be displayed.

A search results page on Ebay is thus dynamic. The programmers that write the code that produces that page are thus king, they control what it does and how it looks. We do not know what computer language they use.

Programming is the Secret

The typical web page design company has no idea how to create this type of page or web site, or even what they are. The ability to write HTML webs page is a very small part of what Ebay does, they are programmers and database administrators. If you want to have your own ebay, amazon or google you need to be or have a programmer. Period. And you need to think from the beginning about

Ebay.com is actually a remarkably simple concept that is not difficult to recreate (of course the million details they have added to that creation is what sets them apart). From the viewpoint of the programmers who made the site it is a marriage of an SQL database with program code that generates pages and acts on page requests to read, write and change database records. From the viewpoint of most people who visit the site it is basically four programs: a login manager, a selling page, a search-to-buy page and a purchase page. However from the viewpoint of the people working in the Ebay office building it is a collection of many administration pages to manage the information in the databases (e.g. the members, the listings, the sales, the feedback).

How can Ebay be so Fast

At any given time millions of people might be using ebay. How can it serve so many people so quickly and efficiently? The answer is their SQL server. Ebay pages request listing information from an SQL database server that is highly tuned to the task and is spread across many powerful computers. The Ebay program software and SQL database server will run on an ordinary single PC if it only needs to serve a few hundred or thousand people. One of the real beauties of client-server computing is that you can start small with a completely functional system and then as needs grow you can scale your communication infrastructure and web and database servers accordingly. But everything runs the same as it did when it was small.

Dream Big, Start Small

Since any ordinary PC today can run Ebay by itself on a small scale, does it not make sense to dream big from the start. But dream big and start small. Take the right roads early, use the right technologies from the start, ones that you understand and control. Do not make the mistake of others, starting with elaborate software and high-maintenance equipment and operating systems and ending up so far down some wrong road it was impossible to come back. Do it right, get knowledge now, don't depend on others to know. Computer industry knowledge always has strings attached, people know what makes them money, not what works. Grow the site with your knowledge. Hire a salesman to do your job and concentrate on understanding how the web works. If you do not understand how yourwebsite.com works then you're not in control it and it is not secure. Ebay started simple, it grew with their knowledge. Do the same thing.

Getting Started

For a step-by-step on getting started (although it deals with moving an existing website), see the bottom of the LAMP Server page.

Contact Tony at Digitalfire

Your email address

Message



Only custom-written web components can go down any road you choose!




DigitalFire Logo

Suite 407, 1595 Southview Drive SE, Medicine Hat, AB T1B 0A1
Answering Machine: (406) 662-0136, FAX: (866) 223-7132

CCBot/1.0 (+http://www.commoncrawl.org/b (4)