Apr 23, 2010

2-Tier Web Architecture

The web architecture is changing for many reasons- read/write, high volume of data, more devices, mobile, etc. The good news is that it's changing in a simple direction.

We all know about this 3-tier web architecture:

Web Server
App Server

Web Server: To serve static contents
App Server: To run business logic
Database : To store data. (SAN/NFS for storage)

What is the problem with this architecture?

Web Server: CDN now does this work. The static requests doesn't (mostly) come to the origin datacenter.

App Server: It itself complex piece of sw. I remember counting 50+ modules in an app server. It ran fine on vertically scalable machines like Sun E10K. How many companies are buying these machines to run app servers? It's challenging to horizontally scale on small machines based on-demand.

Databases: Good for consistency with always-read applications and is still good. Scaling is challenge. Disk IO is expensive. Always-write is challenging with RDBMS. Pl read Amazon's Dynamo paper for details.

So, what is the new web architecture?
It's a 2 tier. You punt one layer to CDN at the top and run your database in memory at the bottom.

Here is the new architecture-

Web(App) Server

Tier-1: It handles HTTP connection + runs the business logic. Example- Apache +PHP or Jetty.
Tier-2: It's memcached supported by a datastore at the back end. The datastore can be MySQL-type or Cassandra-type NoSQL. (You may also want to read Stanford's RAM Cloud paper)

This is the change:
CDN is the new web server.
App Server is the new web server.
MemcacheD is the new database.
RDBMS is the new disk.

Let's expand the above picture with a network diagram:

Round-robin DNS
HAProxy#1 ...... HA Proxy #n
Web(App)Server Farm
MemcachedD Farm

Is this architecture works for all web applications?

You may still need to execute range query against RDBMS. You may still need the consistency. You may still need App Server- RDBMS transactions. Your engineers may not be comfortable writing code close to the metal. But high performance web is clearly moving to some sort of this 2-tier architecture.

Last week here in Sunnyvale, Amazon CTO made a comment in AWS event and that summarizes the new architecture well: "For 90% use cases we use key-value store and for remaining 10% we use RDBMS".

If your application is complex than Amazon.com and gets more traffic than Amazon.com, then you may want to continue with 3-tier architecture!!! If not, think about the future with 2-tier architecture.


At 4/28/2010 4:46 AM, Blogger John said...

Thanks for sharing nice and useful information.
- Web Development Company

At 12/28/2010 10:15 PM, Blogger Rose said...

really amazing information sharing and i just like your blog because of informative content.
- Bollywood Music Reviews

At 1/06/2011 2:16 AM, Anonymous Anonymous said...

it was just amazing information sharing and I appreciate your blog because of unique content so thanks for that.
-Infertility Treatment


Post a Comment

<< Home