Presentation is loading. Please wait.

Presentation is loading. Please wait.

Power for Web Applications. Scaling Cold Fusion Applications Douglas Nottage, Autobytel.com.

Similar presentations


Presentation on theme: "Power for Web Applications. Scaling Cold Fusion Applications Douglas Nottage, Autobytel.com."— Presentation transcript:

1 Power for Web Applications. Scaling Cold Fusion Applications Douglas Nottage, Autobytel.com

2 What Does “Scaling” Mean?  Successfully “Scaling an Application” means that your web site right now is experiencing five times your normal traffic levels but the visitors to the site feel like they are on their own personal T-3 circuit.  If you are reading this and wondering if your site could survive such growth as it stands today, you are not ready to be the next Amazon.com … period.

3 Examples of Scalability  Autobytel.com - Super Bowls 97 & 98  Burst of 19x Traffic Levels within 30 minutes of commercial airing.  Victoria Secret Live Broadcasts  Enough said...  The “Toy Race of 1999”  eToys, Toys ‘R Us, Amazon.com …  If you’re not online, I’ll buy my toys elsewhere.

4 This Presentation  Your Web Server Environment  How to start small and grow  Your Application Environment  Designing Applications Before they Grow  Your Database Environment  Because the World Doesn’t Live on One Application Alone  Putting it All Together...

5 The “Big Bang” - Getting Started  Management wants a web site... Today!  Finance wants you to use one of the “faster computers” on someone’s desk.  Finance denies $1500 for Cold Fusion. You download the 30 day eval. in a panic.  SQL Server? Who has that kind of money?! In a frenzy, you whip up an Access database.  Good thing your ISP does DNS! www.siteofthecentury.com

6 The “Big Bang” - Getting Started  8 am - Marketing runs commercial.  5,000 people visit in 30 minutes.  IIS reports 300 current connections.  Your boss can’t get pages to load on his browser via the 100Mbps LAN.  Your database shows only one order but 5,000 visitors.  At 10 am your boss wants a meeting.  What are you going to recommend? www.siteofthecentury.com XX

7 “Puberty” - Growing Quickly  We need a faster server!  More RAM!  Access is for kids... Let’s upgrade to SQL Server!  Download the web logs and run WebTrends on your desktop.

8 Commercial #2 - Hell on Earth!  8 am - Commercial Airs  8:05 am - Server hits 300 connections.  8:10 am - Extra RAM Is Unused. Why?  8:15 am - Pages are running really slow.  8:16 am - Fearing for your job you decide you must need two web servers.  How do you get one site to go to two different web servers?

9 Round Robin DNS - FREE Solution  When users ask what IP address your site is located on, the DNS server rotates among a set of addresses in a “round robin” fashion, thereby putting load on multiple servers.  Fast and easy to implement. 1 2 3 4 DesktopPC Faster PC or Server

10 Round Robin DNS - No Failover  Desktop PC Fails or Performs much more slowly than Faster PC  Every second visitor is sent to the “Desktop PC” and waits...  What are your options? 1 2 3 4 DesktopPC Faster PC or Server

11 Round Robin DNS - FREE Solution  Re-write DNS so that only Faster PC is in the DNS.  Using one server you are destined to crash Faster PC.  Put two Faster PC records in DNS but only one for Desktop PC to distribute load based upon capacity (2:1 Ratio). 1 2 3 4 DesktopPC Faster PC or Server

12 Round Robin DNS - No Failover  Desktop PC Fails Again.  Every third visitor is sent to the “Desktop PC” and waits...  Round Robin cannot protect against failover.  What are your options? DesktopPC Faster PC or Server 1 2 3 4

13 Hardware Solution  Hardware load balancers like Cisco’s Local Director take ALL of your web traffic and distribute it among servers it sees are ‘alive’ and removes servers if they appear to fail.  Sometimes “dead” servers “appear” alive and receive traffic. 1 2 3 4 Have a second device around in case the first fails.

14 Software Solution - Clustering  Software on each computer monitors its health and when it feels “ill”, sends traffic to another server until it feels it is up to handling a larger load.  Sets of computers configured this way are called “clusters.” 1 2 3 4 Server 1 tells Server 2 it is nearing capacity and starts sending users there. Server 1 is too busy. User is “redirected” to Server 2

15 Hybrid Solution - Best Solution  Load balancing software tells the hardware “how it feels” so the hardware can decide which is the fastest server (at that instant) to send the user to.  The software knows more about the server’s “health” than the hardware does. 1 2 3 4 Have a second device around in case the first fails. Servers tell the hardware load balancer how they are performing.

16 After the Dust Settles...  Company X now has eight web servers in a cluster and users can get to the servers.  However, only one server has SQL Server on it and should it fail, the other servers will not have any data for their applications. 1 2 3 4

17 NT/SQL Clustering  Company X creates two SQL Servers and puts them in an NT/SQL Cluster.  Should the left server fail, the second will take over and the web cluster will get its data from it until the left server is repaired and brought back online. Web Cluster SQLCluster DriveArray

18 Bandwidth Limits and Costs...  Customers now rely upon Company X’s web site and the T-1 line is not enough. Getting more bandwidth is costly.  Is there a cheaper way to grow until you can afford more bandwidth? Web Cluster Consumers Limited Bandwidth Big Demand

19 Using Cheaper Bandwidth...  Company X changes all tags to point to: images.companyx.com  ISP hosts this URL on larger web servers where bandwidth is much cheaper.  Company X uses its expensive in-house bandwidth only for creating CFML pages. Web Cluster Consumers Limited Bandwidth is used for Cold Fusion (Dynamic Content) Pages Only ISP’s Web Server w/ GIFs / JPEGs (Cheaper and larger capacity for static content)

20 Deploying Code to Many Servers  Copying CFML to lots of servers can be cumbersome and time consuming.  Switch IIS to get its content from C:\ to \\SQL2\yourshare\  IIS/CF will get their code from the file share / drive array.  When you post new code it’s live for all. Web Cluster SQL#2 DriveArray SQL#1 CFMLPages for IIS DataforCF

21 Creating a “Staged” Environment  Company X releases a brand new site on January 1, 2000.  On January 2, development starts on a brand new version to launch several months later.  How can you keep a copy of the existing code to develop on and fix bugs with while also working on the new code?  If you can’t use the live web server to develop on, where do you code?  Where do you test code before it is published to the live web server?

22 eCommerce Site Fiber Channel Drive Array End Users Developers Testing SQL Database Web Server Development Test Team Extranet Users SQL Database SQL Database Production Off-Site Image / Proxy Servers SQL & Application NT Cluster Extranet Proposed System Architecture

23 What Servers to Buy?  As soon as possible, upgrade your data to SQL Server and give SQL its own server.  Give SQL as much power as is practical.  Given two uneven servers, the more powerful one should be your data server.  Two dual CPU web servers appears to be better than one quad CPU web server.  Your case is always the exception...

24 Summing Up - Hardware  Dual CPU Web Servers - 256 Mb RAM  Quad CPU SQL Servers - 512+ Mb RAM  Software/Hardware Hybrid Load Balancing & Server Clustering  NT/SQL Cluster to Protect Your Data  Use the Second SQL Server as a CFML File Share to Simplify Uploading Code  Use a Proxy or Web Server at your ISP to Save Your Expensive Bandwidth  Create a “Staged Environment”

25 Cold Fusion Administrator  What are the “optimal” settings for the Cold Fusion Administrator?  Limit Simultaneous Requests To _____?  Timeout Requests - 30 or 60 seconds  Restart at 5 - 10 Unresponsive Requests  Template Cache - How much can you spare?  Cached Query Limits - ???  CFMAIL Timeout - 30 seconds (CPU Threat)  Log Slow Pages - 10 seconds  Assign an SA password!!!

26 Cold Fusion Administrator  Cold Fusion Admin - Security Risks  Password protect or remove /cfdocs folder  Deactivate RDS on production servers  Deactivate CFREGISTRY, CFFILE and CFDIRECTORY if you don’t use them.  Deny CF Studio Access in production.  Rotate CF Admin passwords regularly  Don’t Do Beta … Wait Until It Is Released

27 Cold Fusion - Scalability Issues  Session Variables - Frequently Ineffective  Caching Pages - Only for “static” pages  Caching Queries - Not if excessive  Server Arrays - Keep it in RAM  NEVER use SELECT *  Milliseconds count - Test your application  P-Code Errors - Move to CF4.5  Use SQL where it performs better.

28 Cold Fusion - Scalability Issues  White Space Kills! - Strip it!   Scope Your Variables - form.myVar  Custom Tags - Share Code & pCode  Keep Calculations to a Minimum  Use Stored Procedures  Faster Execution  Less Data to Pass Around  SQL Can Pre-Format Your Data

29 Cold Fusion - Scalability Issues  Application.cfm is NOT a “Cure All”  Loads on EVERY Page  You’re Probably Overloading It  OnRequestEnd.cfm - End of All Pages  Assign an SMTP Server to Cold Fusion  Get the SMTP Traffic Off Your Server ASAP!  Schedule CFML -> HTML Page Creation via CFScheduler / Output to File

30 CF - Session Variables  In a multiple-server environment, it is likely that visitors will jump around to multiple servers during the same visit in order to always use the fastest one per page.  Session variables are stored in individual servers, so if visitors jump around the variables don’t jump with them.  Solution: Store an ID or “uuid” in a cookie or in a URL variable and keep the user’s variables in a database.

31 Database Suggestions  Use stored procedures where possible.  Let SQL do the work where appropriate.  Learn your Query Optimizer  Use Indices Appropriately (INDEX=…)  Have Enough RAM to Store Your Databases, Indices and Have Extra  Identity Columns & @@identity  Ordering Your WHERE Clause

32 Database Suggestions - Cont.  Max(), Min(), Sum() and Count() - Use!  Review SQL Execution Plans!  Identify Bottlenecks and Fix in Development  Use Verity, Not SQL, For Word Searches  Use (NOLOCK) If “Dirty Reads” Are OK.

33 Web Log Analysis  Download Your Web Logs and Run them Off-Line - Save Your Web Server CPU.  If You Won’t Use It - Don’t Report It  Remove.GIF/.JPEG From Your Analysis  They Don’t Count  They Slow Down the Reporting  Don’t Do Reverse IP Lookups  It Slows Down Reporting a LOT  Let’s Face It - AOL IS 30-50% of the Users  The Military Will Hate You

34 Web Log Analysis  Frames = More Pages to Analyze = Bad  Don’t Use SQL-Enabled Web Analyzers

35 How To Monitor Your Systems  IpSwitch - WhatsUpGold  IpSwitch - iMail for NT (w/ Monitors)  Keynote - World-Wide Sensor Network  Spectrum - $$$  ClusterCats Administrator (CF Enterprise)

36 Remember...  Scalable Applications Scale with Cold Fusion in Scalable Environments.  … Does your Application Scale?  Thanks for your time and Good Luck!


Download ppt "Power for Web Applications. Scaling Cold Fusion Applications Douglas Nottage, Autobytel.com."

Similar presentations


Ads by Google