Strategies For Scaling ColdFusion
Download
Report
Transcript Strategies For Scaling ColdFusion
Strategies
for Scaling
ColdFusion
Caching
enabling rapid growth through dynamic digital solutions
Page Request Supply Chain
Data/Persistence
Business Logic
Middleware
File
System
Application
Servers
Transport
Client
Web Internet
Server
COM
Network
EJB
RDBMS
Cold Fusion
Application
Server
JDBC
Web
Server
Web
Browser
Routers
OTHER
local
MQ
proprietary
HTML/text
Images/binary
OTHER
remote
Request Processing
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Typical Work Breakdown
Avg. Page Response time: 7 seconds
SQL
Queries
CF
Logic
Web
Server
5 x 30 ms 5 x 100 ms
=150 ms =500 ms =50 ms
Internet
IE
NS
=5000 ms =1000 ms
Transport Client
Data Business
Access Logic Presentation
Rendering
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Generating Pages Faster
1. Smaller pages
smaller images
less whitespace
2. Faster transport
over network
3. Faster CF page
generation
4. Faster DB access
SQL
Queries
CF
Logic
Web
Server
Internet
IE
NS
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
What is Caching?
Temporary storage of the data from
a prior process as possible to the
next data consumer
Cached data can be accessed
programmatically served by network
appliances/processes
Optimized data format
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Opportunities for Caching
Data
Business Logic
Middleware
File
System
Application
Servers
Transport
Client
Web Internet
Server
COM
Network
EJB
RDBMS
Cold Fusion
Application
Server
JDBC
Web
Server
Web
Browser
Routers
OTHER
local
MQ
OTHER
remote
Request Processing
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Techniques
Web
Browser
RDBMS
Java
DB Caching
Most database systems have
have facilitates to cache
frequently requested data.
Additionally, 3rd party tools
like timesten offer remote
DB caching
Cold Fusion
Application
Server
Web
Server
Routers
Network
Webserver Caching
xCache caches fully
or partially rendered
CF pages and strips
whitespaces
CF Caching
Stores optimized, rendered
and/or processed data.
Object Caching
PowerTier maintains a
transactional, distributed cache
of java memory objects. Can be
configured to write back to
RDBMS or other data providers.
Cache appliance
Caches text
or images
Client cache
Caches entire page
on browser
Cache network
Akamai, Sandpiper
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Checklist
DB caching
CF caching
• Frequently used queries
• Frequently used data structures
• Rendered HTML (components, partial
pages)
• Entire pages (CFCACHE)
Web server caching
• xCache
Cache appliances
• Reverse proxy server
• Cache network
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Database Caching
Most major databases allow for caching
of data in RAM on the database server
This will minimize the work the
database server needs to do to process
each request
3rd party tools such as TimesTen
(www.timesTen.com) allows for full
RDBMS functions to be provided in a
RAM based database
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
CF Cached Queries
ColdFusion allows for commonly used
queries to be cached in RAM
This is done through the use of the
CACHEDWITHIN and CACHEDAFTER
parameters of the CFQUERY tag
Using cached queries reduces the
number of network calls, as well as
reducing the load on the database
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Data in CF Structures
Using CF structures, it is possible
to load large sections of data into
persistent memory variables
(server, application, session or
request), reducing the need for
network connections and database
processing of each query
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Data in CF
Structures - Advantages
Extremely fast queries. Serving
data directly from RAM removes
costly network connections and
database processing time
Removes points of failure from the
application. Application can
continue to run, even if the
database server fails
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Data in CF
Structures - Disadvantages
Requires significant amounts of RAM
Difficulties are introduced when data is
updated and must be kept consist
across all machines in a cluster
Requires more knowledgeable
developers to query a database stored
in structures than it does to use a
CFQUERY tag
Requires lengthy scripts to run as a
server comes online to populate
structures in RAM
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Page Caching Using CFCACHE
CFCACHE allows page rendering speed to be
increased considerably
For pages that do not require dynamic
content to be retrieved for each user,
CFCACHE will create temporary files that
contain the static HTML returned from a
particular run of the ColdFusion page
Can be used to specify server or client side
caching, as well as cache timeouts
Can only respond to URL variables
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
CFCACHE
Advantages:
Cache can be
programmatically
purged
Easy to use
Excellent for
caching page
data polled using
CFHTTP
Disadvantages:
ColdFusion still
involved in
processing
requested file
URL driven, can
not customize
based on form
(or other)
variables
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Semi Static Pages
Semi static pages are any pages
which are database driven, yet
identical for all users who view it.
This can include:
• Product information
• Company information
• Job listings
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Semi Static Pages
Static pages can be created from
production data, either using home
built CFFILE solution, or 3rd party
applications such as Post Point xBuilder
(www.xcache.Com)
Verity collections can be used to search
the static HTML pagse, negating the
need for a SQL search
Index pages can be created, which link
to the static HTML
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Semi Static Pages
Advantages
ColdFusion is not
used in the
process of
displaying the
page
No database
interaction to
display the page
Disadvantages
Can only work for
pages which are
identical to all
users
Requires more
space on hard
drive
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Web Server Caching: xCache
xCache allows for full and partial page caching
xCache works along side ColdFusion, and
parses incoming requests before it does
Parts of pages which should not be cached
can be marked with <xcacheoutput> tags,
which tells xCache to let CF parse that section
of a page
Pages which should not be cached can be
marked with <meta name=“pragma nocache”> tags
xCache administrator can be used to set
caching for sites, directories or pages
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
xCache Advantages
No coding changes necessary
Easy to administer
Dynamic ColdFusion at static
HTML speeds
Partial page caching possible.
Compression eliminates
whitespace
No additional hardware necessary
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
xCache Disadvantages
Only works with Microsoft Internet
Information server
Entirely URL driven, making
personalization more difficult
Current release is language /
browser ignorant (multi-lingual
sites more difficult)
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Sample xCache Metrics
Average Response Time
(80 concurrent users)
40
36.08
Seconds
35
30
22.64
25
17.28
20
15
9.2
10
5
Cached
Uncached
3.31
1.34
1.15
1.18
0
About us
Contact us
Partners
Today's
News
Page
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Reverse Proxy Servers
Reverse proxy servers are hardware
based caching appliances
Sit between Web server and clients.
Can be set to cache static files (.Html,
.jpg, .Gif, .Js, etc.)
Popular commercial products include
‘Intel NetStructure 1500 Cache
Appliance’ and ‘F5 edge FX cache’
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Reverse Proxy Server Advantages
Non dynamic content can be served as
static HTML files, removing the need
for ColdFusion to touch the file
Uses a separate Web server offloading
the work needed by the Web server
ColdFusion uses
One cache server can cache files for
entire cluster
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Reverse Proxy Servers Disadvantages
Hardware based caching servers
are more expensive than software
based solutions
Can not cache partial pages
No programmatic control of cache
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Sample Intel NetStructure
1500 Cache Appliance Metrics
Average Response Time
60 concurrent users
40
35
Seconds
30
25
21.21
20.60
20
16.54
15.72
15
Cached
Uncached
10
5
0.91
0.83
0.75
0.97
0
Homepage
About Us
Services
Portfolio
Pages
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Adding A Reverse Proxy Server
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Networks
A recent trend in application
architecture has been to distribute
application caches
Allows for users to download
pages and graphics from the
server geographically closest
Reduces internet latency
Removes points of failure
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Caching Networks Suppliers
Akamai (www.akamai.com) offers
distributed caching services
F5 (www.f5.com) sells 3-DNS and
EDGE-FX controllers, allowing users to
build their own caching network
Cisco (www.cisco.com) sells
DistributedDirector, which allows
customers to optimize server load by
distributing the load across disparate
networks
nj | nyc | boston | chicago | uk
enabling rapid growth through dynamic digital solutions
Conclusion
Caching can help performance of all of
the slowest aspects of any application
Planning caching early can help save
time and money in scaling applications
Effective caching helps existing
hardware handle more requests,
helping to save the costs of additional
servers
With effective caching, any application
can be scaled to handle extreme traffic
nj | nyc | boston | chicago | uk