SAP hybris Caching and Monitoring

Post on 13-Jan-2017

773 views 12 download

transcript

SAP hybris Knowledge

Transfer SessionsCaching and Monitoring

Joe Huangjoe@1solution.com

Agenda• Caching Areas• Hybris Caching• Eviction Policy• Cache Region• Performance Monitoring• Monitoring Tools:• Hybris Admin Console Monitoring Tools• Third Party Monitoring Tools

Caching Areas

Browser Caching

CDN• Content Distribution Networks (CDN) provide a distributed set of

proxy servers placed in multiple data centers across the internet.• The Distributed Approach.• Flexible control over content cacheability.

Varnish Caching• It is HTTP accelerator know as caching HTTP reverse proxy• Can be installed in front of hybris.• Can be configured to cache contents (page fragments)

Web Server Caching Consideration• Serve all static content from web server.• Add header cache control in httpd.conf to cache static content:• Header append Cache-Control public,max-age=600

• For detail configuration, refers to:https://wiki.hybris.com/display/hybrisALF/Static+Content+Serving+from+Apache

SAP hybris Caching•Hybris Caching•Hybris hAC Monitoring

Hybris Platform Cache• What to be cached?• Data

• Why need caching?• Improves the performance

• When Data is Cached?• Hybris Region Cache provides fine-grained control in cache configuration.

• When Data is Removed from Cache?• When cache max out.• When cache entry is not valid any more.

Hybris Caching• Regions based cache

• By default: EHCache implementation of region.• Provided: hybris implementation as an option (for backward compatibility)

• Each region is configurable:• What types it’s caching• The maximum size• The eviction policy

• Each hybris model is cached• Each FS query is cached

• Hint: avoid FS queries with small differences (e.g. with new Date())

• No master cache server

Cluster Communication

• Each cluster has its own cache• Caches are invalidated either TCP(JGroups) or UDP network messaging

• Clustering methods (Jgroups leverage udp mcast -recommended )• JGroups provides fastest communication (can be used on cloud)

Cluster Communication – continue• Jgroups-based cluster implementation:

When Data Is Cached (and invalidated)• Caching items:• When calling flexible search or getters that refer to ComposedTypes,

the underlying data is returned from the cache or, if not yet cached, first retrieved and then written to the cache. • When calling modelService.save, the cached value is invalidated (and

hence removed from the cache)• Caching FlexibleSeach results:• When executing FlexibleSearch query like: SELECT code FROM Product

the list of results is cached in the main cache.• When a product is removed, then its item data and the cached flexible

search result for the above query are removed from the cache.

Eviction policies• First In, First Out (FIFO): Elements are evicted in the same order as

they come in. When a PUT call is made for a new element, and assuming that the maximum limit is reached for the memory store, the element that was placed first (First-In) in the store is the candidate for eviction (First-Out).• Least Frequently Used (LFU): For each GET call on the element the

number of hits is updated. When a PUT call is made for a new element, and assuming that the maximum limit is reached for the memory store, the element with least number of hits, the Less Frequently Used element, is evicted.

Eviction policies - Continue• Least Recently Used (LRU): The last used timestamp is updated when

an element is put into the cache or an element is retrieved from the cache with a GET call.

How Data is Cached• Region Cache – configurable• Standard configuration:

EntitySize:100,000

Eviction Stratagy: FIFO

TypesystemSize:Unlimited

Eviction Stratagy: No

QuerySize:20,000

Eviction Stratagy: FIFO

MediaSize:500MB

Eviction Stratagy: LRU

Custom Caching Configuration• Example:

EntitySize:100,000

Eviction Stratagy: FIFO

TypesystemSize:Unlimited

Eviction Stratagy: No

QuerySize:20,000

Eviction Stratagy: FIFO

MediaSize:500MB

Eviction Stratagy: LRU

MichillinSize:20,000

Eviction Stratagy: LFU

GoodYearSize:10,000

Eviction Stratagy: LRU

Create New Custom Cache Region• In core extension spring xml.• In core-cache.xml create new cache region bean.• In core-cache.xml add new created cache region bean into the cache

region list.• Access caching by using DefaultCacheController.

Caching Configuration• To change preconfigured cache region settings, provide new values in

the local.properties for the preconfigured parameters:

Performance – What Can Effect Performance?• Transaction volume• Poor system design – architecture level and code level.• Poor caching design/setting.• Poor database performance – data model issue or transactional issue.• Poor network performance.• Poor integration design – caution on real-time backend system

integration.• Check here for some typical hybris performance issues and solutions:

https://wiki.hybris.com/display/hybrisALF/Typical+Performance+Issues

Performance Monitoring – Area to Monitor• Database access monitoring, include transaction based access.• Database connection.• Memory usage.• Load distribution.• Caching usage.

Tools to using for Monitoring• Hybris Admin Console (hAC)• Third Party Application Monitoring Tools• dynaTrace• New Relic (cloud based SaaS)• JMX

hAC Minitoring Tools

hAC Minitoring Tools - Home

hAC Minitoring Tools - Caching

hAC Minitoring Tools - Database

hAC Minitoring Tools -

hAC Minitoring Tools -

dynaTrace – Page Performance

dynaTrace – Database Performance

dynaTrace – Server Performance

dynaTrace – Web Request Distribution

dynaTrace – Solr Performance

Other Monitoring Tools• New Relic – Cloud based monitoring tool• JMX – Java Management Extension to expose various attributes

related to system properties, transactions, database statistics etc.

Question & Answer

Further Question or need a private session? Ask joe@1solution.com