Architecting for scalability in cf

Preview:

DESCRIPTION

Architecting for Scalability from cfObjective() 2011

Citation preview

How to make bullet proof applications

BBA in ISYS & Mgmt, Minor CS UND ImageTrend, Inc. 4+ years ◦ Currently: Lead Developer

cf.Objective() attendee 5 years MAX 2008 (San Francisco) Attendee Contact: ◦ twitter: tedsteinmann ◦ tedsteinmann@gmail.com

BS Computer Science, University of Minnesota, 2005

ImageTrend, 5+ years

◦ Currently: Application Architect

cf.Objective() attendee 4 years

Contact: ◦ twitter: timlmeyer

◦ tim.l.meyer@gmail.com

Framework Sale

Buy my blog

Group Think

Miracle Drug

Explanations

Solutions

Suggestions

Demos

The Big Idea

Concerns

Considerations

Challenges

Solutions

Additional Considerations

We want to make a website…

We’re going to call it Spacebook…

We’re going to be millionaires…*

* If we don’t get sued by these guys

Performance

Uptime

Availability

Failover ◦ Accidents

◦ Maintenance

◦ Uncontrollable events

s##t happens

Scalability ◦ Popularity problems:

Increased traffic/load

Hardware limitations

Complexity

“Okay, let me tell you the difference between

Facebook and everyone else, we don't crash EVER! if those servers are down for even a day, our entire reputation is irreversibly

destroyed! “

Things we know ◦ Redundancy

◦ Routing

◦ Replication

Proven methods/approaches ◦ Server Clustering

◦ Request Routing

◦ Replication/Mirroring

◦ Process Delegation

◦ Memory Management

Clustering ◦ High-availability Failover

Redundancy

◦ Load Balancing

Request Routing ◦ Routing Rules

◦ Server Farms

◦ Load Balancing

◦ Programmatic failover

◦ Asset Caching

Clustering & Routing

Replication/Mirroring

Process Delegation

◦ Asynchronous task completion

◦ Work queues

Memory

◦ Scale Out

Many small CF instances

◦ Scale Up

Fewer large instances/servers

Persistence of State

Persistence of Data

Configuration

◦ Persistence of State

◦ Session Management Browser Session & Server session

Session/logged in

Replication / Sticky Sessions

Client vs. Session

Persistence of Data

◦ Variables

◦ File system

◦ Database

Persistence of Data - Variables

◦ CGI scope

Cannot rely on web servers or proxy servers to set them consistently

Cannot set CGI variables

◦ Session scope

◦ Client scope

Persistence of Data – File System

◦ Multiple copies of your application code

Code promotion / Release

◦ Management of user generated content

Persistence of Data - Database

◦ Identifiers

Identities/auto incremented primary keys

◦ Release

New data structure

Structure change/removal

Configuration

◦ Will need to take place in/on:

Every location

Every server

Every environment

Dev, alpha, beta, testing, prod, etc.

Make it Easier to Change - Session Façade session.cfc:

usage:

Challenge: Persistence of State

Session/Client Data Management

◦ Database

◦ Client Scope as Session Scope

◦ Caching Servers

Session/Client Persistence

◦ Cookies

◦ URL Token Based

Challenge: Persistence of State

Use Façades

◦ CGI

◦ Session

◦ Client

Challenge: Persistence of Data - Variables

Don’t be a dope …wrap you scopes!

File System Design Strategies

◦ Database files

◦ Network shared file system

◦ Automatic replication of files

Automate code deployments ◦ ANT, .bat, etc.

Challenge: Persistence of Data – File system

Database Design Strategies

◦ Identifiers GUIDS

Ranges

Clustered primary keys

Server name/location/identifier

Roll your own

◦ Release

Backwards compatibility

Location specific updates

Challenge: Persistence of Data – Database

Centralized Automatic configuration ◦ CFAdmin API

◦ XML config files

◦ Dynamic file paths

◦ Datasource configuration

Challenge: Configuration

Globalization ◦ Time zones

◦ Multiple Languages

Caching ◦ Distributed cache stores (ehcache, memcached)

Database Role Segmentation ◦ One or many databases for reads / one for writes

at each location

Verification - Will my application really scale? ◦ Load Testing

◦ Failover Testing

◦ Can I seamlessly add to the hardware?

Roll your own clustering/deployment ◦ JBOSS

◦ Tomcat

ColdFusion: ◦ Administrator API ◦ Environment Configuration ◦ CF design patterns (sessions) ◦ Managing the client state ◦ Configuring and using session variables: ◦ JVM Memory Management ◦ JRUN Configuring Individual JVM Settings ◦ JRUN Clustering ◦ ColdFusion 9 on JBOSS ◦ ColdFusion Clustering ◦ Enabling clustering for load balancing and failover ◦ House of Fusion ◦ Database Your Files (Tim’s Presentation from TCCFUG)

Recommended