jasonrexilius.com

Geographically Distributed Web Cluster Approach

by Jason Rexilius

This is the approach my company is taking to building an extreme high-availability, scalable platform for delivering software as a service.

We currently have a basic model in place with two data center locations and are building out the rest of the platform this year.

It may be helpful to read the background article on the Web Transaction Model if you are not familiar with the links in the chain of web transactions.

1) Location, Location, Location!

it matters even on the 'Net



Level 3 and Cogent - http://www.isp-planet.com/business/2005/cogent_level_3.html
FBI raids hoster - http://www.carrierhotels.com/news/2004/Feb/19/fbi_shutters_web_host.shtml
Akamai Outage - http://www.internetnews.com/infra/article.php/3369371
Equinix Outage - http://blogs.feedburner.com/feedburner/archives/001280.html





2) High Level Overview

the same thing we do everyday Pinky..



http://en.wikipedia.org/wiki/The_Myth_of_the_Nines

http://www.spec.org/web99/
single properly tuned node should handle:
- 2,000 concurrent SSL connections
- 1 transaction per second, per connection
- 10meg memory per connection/transaction

3) DNS

first link in the chain

notes:

- Win -> Start > Run > Cmd > ipconfig /flushdns
- OSX -> lookupd -flushcache
- Lin -> /etc/init.d/nscd restart
- more Windows hacks
	http://support.microsoft.com/default.aspx?scid=kb;en-us;318803
- Block Negative Entries
	HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
	DWORD: MaxNegativeCacheTtl
	Value: 0
- Cache TTL
	HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters
	DWORD: MaxCacheTtl
	Value: 60

4) Node Clusters

current approach within single data center


5) Self Describing Distributed Sessions

dealing with bouncing users

// AT TRANSACTION (PAGE) BEGINNING: if(isset($_COOKIE['SESDATA'])){$_SESSION=unserialize(gzuncompress(base64_decode(myDecrypt(urldecode($_COOKIE['SESDATA'])))));}
// AT TRANSACTION (PAGE) END:
setcookie('SESDATA',urlencode(myEncrypt(base64_encode(gzcompress(serialize($_SESSION))))),0,'/','',1);

if ( $Compressed_Encrypted_Session_Data < 4000 bytes ) {

   Store_Session_In_Cookie( $Compressed_Encrypted_Session_Data )
 }else{
   Store_Session_In_Two_Nodes( $Node1, $Node2, $Compressed_Encrypted_Session_Data )
   Store_Location_Of_Session_In_Cookie ( $Node1, $Node2 )
 }


6) Data Persistence

those damn DB's, too big to cover in depth


7) Tidbits