Transcript
Page 1: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

ColdFusion Summit 2016

Page 2: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Developing High Performance and Scalable ColdFusion Applications

Using Terracotta Ehcache

By: Shailen Prasad

Product Management & Strategy

In-Memory Computing

Software AG USA, Inc.

Page 3: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

What is this?

Growth will happen when efficiency increases. Plow did what

"In-Memory computing is doing to the human race today"

Page 4: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Why you (and I) are here ?

Page 5: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

What will be covered in this presentation?

� How to scale – options (pros and cons)

� Caching basics (various options available)

� Recent updates of Open source Ehcache project.

� Ehcache, Terracotta OSS and BigMemory

� The benefits of distributed caching for building applications where latency and performance is

crucial.

� Advance caching techniques for scaling your current CF application using Terracotta distribution

caching (BigMemory)

� To conclude, highlights on some customer use cases where caching was mission critical

In-Memory caching and data management is becoming mainstream for accelerating

business applications. This session will introduce :

Page 6: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

SCALE OUT

SCA

LE U

P

Scale your existing applicationAlso knowns as “Vertical Scaling”

� Pros:

• Less power consumption than

running multiple servers

• Generally less challenging to

implement

• Less licensing costs

� Cons:

• $$$ VERY EXPENSIVE

• Greater risk of hardware failure

causing bigger outages

• Generally severe vendor lock-in

and limited upgradeability in the

future.

Also knowns as “Horizontal Scaling”

� Pros:

• $ Much cheaper than scaling

vertically

• Easier to run fault-tolerance

• Generally easier to upgrade

� Cons:

• Bigger datacenter foot print

• Higher power consumptions

• Possibly more network resource

dependency

Ad

din

g m

ore

RA

M/C

PU

Adding more machines

Page 7: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

In-Memory Caching – In a nutshell

On Heap Cache (also known as In-Process Cache) or L1 cache

ColdFusion Application

CF Internals

On Heap

Cache

JVM

• Fastest among all other caching tier

• Doesn’t require marshalling and un-marshalling of the

data

• Limited by Max JVM heap size (limited on 32 bit systems)

• Garbage collection – still remains the challenge

Page 8: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Caching – In a nutshell

Local Off Heap Cache (in-process caching) or L1 cache

ColdFusion Application

CF Internals

Local On-heap

Cache

JVM

Local Off-heap Cache

Direct memory buffers

• Access Memory outside of Application heap

• Can Scale as it is not limited by JVM heap size even on a 32

bit machine

• Application doesn’t have to worry about Garbage collection

for the data stored in off-heap

• Slower than on-heap cache, entries has to serialized and de-

serialized.

Page 9: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

JVM

Local Off-heap Cache

Caching – In a nutshell

Distributed Off Heap Cache (also known as Out-of-Process

Cache) or L2 cacheColdFusion

Application

CF Internals

Local On-heap

Cache

JVM

L1Off-heap Cache

JVM

L2 Off-heap Cache• Runs outside of the Application Server JVM

• Slower than local offheap – reads/writes are over the

network

• Highly scalable with its distributed design

• Adds resiliency with more fault tolerance

Page 10: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

JAVA’s MOST WIDELY USED CACHE

Page 11: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache
Page 12: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

� Seamless integration with many popular Java frameworks/applications

Page 13: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

� Open Source

� Current in CF2016 - Ehcache 2.10.0

� Ehcache 3.x (complete overhaul with lots of improvements!!

� Revamped API that leverages Java generics and simplifies Cache interactions

� Full compatibility with javax.cache API (JSR-107)

� Offheap storage capabilities, including offheap only caches

� Out of the box Spring Caching and Hibernate integration thanks to the javax.cache support

� Significant improvement in performance over all its previous versions

� And many more ... (more at www.ehcache.org)

Page 14: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

90% of Data in

Memory

MODERNIZE Database

90% of Data in

Database

Memory

App Response Time

MillisecondsApp Response Time

Microseconds

Page 15: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Since ColdFusion 9

Page 16: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

ColdFusion's Ehcache resources

1. CF2016 – Ehcache 2.10.0 (Latest Ehcache in 2.x line: 2.10.2)

2. CF 2016 Ehcache libs:

� <CF_HOME>/cfusion/lib/ehcache-2.10.0.jar (core library)

� <CF_HOME>/cfusion/lib/ehcache-web-2.0.4.jar (web content caching)

� <CF_HOME>/cfusion/lib/hibernate-ehcache-4.3.10.Final.jar

3. CF 2016 Ehcache configurations:

� <CF_HOME>/cfusion/lib/ehcache.xml

� <CF_HOME>/cfusion/lib/auth-ehcache.xml

� <CF_HOME>/cfusion/lib/ehcache-default-config.xml

Page 17: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

ColdFusion's current use of Ehcache

• CF Authentication:

auth---ehcache.xml: authcache, authtokenmappingcache

• Internal Caching (CF templates, component paths)

• <cfcache> - Cache fragments of html

• <cfquery> - Cache DB calls

<cfquery name="myAccount“ cachedwithin=#createTimeSpan( 0, 1, 0, 0 )#>

• ORM with Ehcache 2nd level caching: Caching Hibernate queries

Entityload('BlogPost',{},{cacheable=true})

• CF Cache functions: Direct Ehcache calls

CacheGet / CachePut / CacheRemove / CacheGetAllIds

CacheGetMetadata

CacheGetProperties / CacheSetProperties

• Custom CF JAVA components using Ehcache library directly

NOTE: ALL THE ABOVE FEATURES CAN BE EASILY DISTRIBUTED USING TERRACOTTA

Page 18: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

A Classic CF application

Page 19: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

A common challenge

As the application user base increases the user experience starts to get questioned (?)

Page 20: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Lets get the plow working �

A quick and simple solution – Ehcache Standalone (LOCAL CACHING)

Page 21: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Improved caching – Ehcache Replication

Improve Caching with some caveats

Page 22: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Coldfusion + Ehcache + Terracotta Opensource

=

Seamless, Powerful Distributed In-Memory

Caching with Free Open-Source Software

Page 23: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Just a little tweak on the Ehcache.xml

Page 24: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta 4.x Open Source Offering/Architecture

� Standard Java

� Proven TBs scale capacity

� Not managed by the JVM

No Garbage Collections

Predictable latencies

� No specialized appliance needed

Page 25: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Easy scalability: New clients can access all cached data

Page 26: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Powerful H/A = Automatic failover/no cache data loss

Page 27: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

ColdFusion + Ehcache +Terracotta

Terracotta Distributed Ehcache: High Scalability Caching

Page 28: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Coldfusion + Ehcache + Terracotta Bigmemory

=

Seamless, Powerful Distributed In-Memory

Caching with Free Open-Source Software

Page 29: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Any kind of data can be stored in Terracotta BigMemory to make

an application speed up & scale out

Terracotta BigMemory has different tiers for data storage

that can be configured based on an application’s

requirements

Terracotta In-Memory Data grid - Rich data storage & Access

Page 30: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta BigMemory – Scale out indefinitely

Page 31: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta BigMemory Performance Scaling

Terracotta BigMemory Max* provides predicable latency and throughput as data volume increases

Page 32: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Choose your own cache read consistency

with simple config change

Page 33: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta Management Console

View your Terracotta servers and clients topology

Page 34: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta BigMemory – Manage & Monitor

Track performance trends and discovering potential issues.

Page 35: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta Management Console

Monitor all cache instances and their configuration and manage your cache/cache manager.

Page 36: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta Management Console

BigMemory SQL queries against your caches

Page 37: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta BigMemory – Fast Restart Store

Big Memory's disk persistence and Fast Restartability

Page 38: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Setting up Coldfusion 2016

with Terracotta 4.3.2

Page 39: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Terracotta OSS Setup is just a few steps…

1. Download Terracotta OSS (latest terracotta-4.3.2.tar.gz) at

http://www.terracotta.org/downloads/open-source/catalog

2. Extract to the location of your choice

3. Ensure JAVA_HOME is set

4. Navigate to <TERRACOTTA_INSTALL>/server/bin

5. Start with default single node config by executing:

start-tc-server.sh (or .bat)

6. Terracotta process is now accessible at IP:9510

Note: If setting up Terracotta in active/mirror setup, tc---config.xml must be created and referenced

at startup:

start-tc-server.sh (or .bat) -f <path-to-config>/tc-config.xml –n <server-name-to-start>

Page 40: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Connecting ColdFusion to Terracotta in few steps…

1. Copy Ehcache + Terracotta libs to <CF_HOME>/cfusion/lib

� <TERRACOTTA_INSTALL>/apis/ehcache/lib/ehcache-2.10.1.jar

� <TERRACOTTA_INSTALL>/apis/toolkit/lib/terracotta-toolkit-runtime-4.3.2.jar

2. Add terracotta-specifics configurations in CF ehcache configs:

� <CF_HOME>/cfusion/lib/ehcache.xml

� <CF_HOME>/cfusion/lib/auth-ehcache.xml

3. Restart CF

4. Notice Terracotta connection in CF logs

Page 41: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

All the below CF caches are now in Terracotta

• CF Authentication:

auth---ehcache.xml: authcache, authtokenmappingcache

• Internal Caching (CF templates, component paths)

• <cfcache> - Cache fragments of html

• <cfquery> - Cache DB calls

<cfquery name="myAccount“ cachedwithin=#createTimeSpan( 0, 1, 0, 0 )#>

• ORM with Ehcache 2nd level caching: Caching Hibernate queries

Entityload('BlogPost',{},{cacheable=true})

• CF Cache functions: Direct Ehcache calls

CacheGet / CachePut / CacheRemove / CacheGetAllIds

CacheGetMetadata

CacheGetProperties / CacheSetProperties

• Custom CF JAVA components using Ehcache library directly

Page 42: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Still so much used and Distributed �

The Picture says it all !!! – The power of distributed In-Memory computing.

Page 43: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Customer Use cases

Page 44: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Success Stories: Fortune 500 online payment processor

Radically Improving Profitability With Better, Faster

Fraud DetectionSPEED

What they wanted

Before BigMemory

• Dramatically boost bottom-line profit through faster, more accurate fraud detection

• Lost 30 cents on every $100 to fraud

• With Oracle Exadata, failed to meet 800 ms SLA around 10% of time

• Limited to 50 rules, even though each new rule generated $12 million in profit

Page 45: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Success Stories: Fortune 500 online payment processor

SPEEDSPEED

After BigMemory:

Savings of tens of millions of dollars in reduced costs from missed SLAs and fraudulent charges

Meeting stricter 650-millisecond SLA 99% of time

Savings of $1 million annually in reduced database licenses

Plans to expand from 4TB to 150TB for new applications and to achieve 250 millisecond SLA

Page 46: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Success Stories: Healthcare.gov

Page 47: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

“The team began almost immediately to

cache the data. The result was encouraging:

the site's overall response time--the time it

took a page to load--dropped on the evening

of Oct. 22 from eight seconds to two. That

was still terrible, of course, but it represented

such an improvement that it cheered the

engineers. They could see that HealthCare.gov

could be saved instead of scrapped.”

Success Stories: Healthcare.gov

Page 48: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Challenges• All data access to backend database (many round-trips)• 10+ seconds response times• Numerous down-times due to concurrent users

Benefits• Provide in-memory data access such as subscriber data and provider

comparison information• Session replication of user profile info• Performance & Scalability

Success Stories: Healthcare.gov

Page 49: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

App

Server

App ServerApp Server

App ServerApp Server

Ehcache

App ServerApp Servers

App Server

Ehcache

Security Gateway

“Presentation Zone” “Application Zone”

App Server

App Servers

JMS

Individual

& Families

Issuers

3rd Parties

(B2B)

SOR

Page 50: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Thank you!

Not new but still makes a difference everyday!

Page 51: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Questions?

www.ehcache.org

www.terracotta.org

www.softwareag.com

Shailen Prasad

Sr. Mgr, Product Management & Strategy (Terracotta),

Software AG USA, Inc.

[email protected]

www.linkedin.com/in/shailenprasad

www.twitter.com/shailenprasad

Page 52: Developing High Performance and Scalable ColdFusion Applications Using Terracotta Ehcache

Thank you!


Recommended