sap hybris caching and monitoring

35
SAP hybris Knowledge Transfer Sessions Caching and Monitoring Joe Huang [email protected]

Upload: zhuo-huang

Post on 13-Jan-2017

774 views

Category:

Technology


12 download

TRANSCRIPT

Page 1: SAP hybris Caching and Monitoring

SAP hybris Knowledge

Transfer SessionsCaching and Monitoring

Joe [email protected]

Page 2: SAP hybris Caching and Monitoring

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

Page 3: SAP hybris Caching and Monitoring

Caching Areas

Page 4: SAP hybris Caching and Monitoring

Browser Caching

Page 5: SAP hybris Caching and Monitoring

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.

Page 6: SAP hybris Caching and Monitoring

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)

Page 7: SAP hybris Caching and Monitoring

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

Page 8: SAP hybris Caching and Monitoring

SAP hybris Caching•Hybris Caching•Hybris hAC Monitoring

Page 9: SAP hybris Caching and 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.

Page 10: SAP hybris Caching and Monitoring

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

Page 11: SAP hybris Caching and Monitoring

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)

Page 12: SAP hybris Caching and Monitoring

Cluster Communication – continue• Jgroups-based cluster implementation:

Page 13: SAP hybris Caching and Monitoring

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.

Page 14: SAP hybris Caching and Monitoring

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.

Page 15: SAP hybris Caching and Monitoring

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.

Page 16: SAP hybris Caching and Monitoring

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

Page 17: SAP hybris Caching and Monitoring

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

Page 18: SAP hybris Caching and Monitoring

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.

Page 19: SAP hybris Caching and Monitoring

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

the local.properties for the preconfigured parameters:

Page 20: SAP hybris Caching and Monitoring

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

Page 21: SAP hybris Caching and Monitoring

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

Page 22: SAP hybris Caching and Monitoring

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

Page 23: SAP hybris Caching and Monitoring

hAC Minitoring Tools

Page 24: SAP hybris Caching and Monitoring

hAC Minitoring Tools - Home

Page 25: SAP hybris Caching and Monitoring

hAC Minitoring Tools - Caching

Page 26: SAP hybris Caching and Monitoring

hAC Minitoring Tools - Database

Page 27: SAP hybris Caching and Monitoring

hAC Minitoring Tools -

Page 28: SAP hybris Caching and Monitoring

hAC Minitoring Tools -

Page 29: SAP hybris Caching and Monitoring

dynaTrace – Page Performance

Page 30: SAP hybris Caching and Monitoring

dynaTrace – Database Performance

Page 31: SAP hybris Caching and Monitoring

dynaTrace – Server Performance

Page 32: SAP hybris Caching and Monitoring

dynaTrace – Web Request Distribution

Page 33: SAP hybris Caching and Monitoring

dynaTrace – Solr Performance

Page 34: SAP hybris Caching and Monitoring

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.

Page 35: SAP hybris Caching and Monitoring

Question & Answer

Further Question or need a private session? Ask [email protected]