Upload
bertrand-delacretaz
View
1.530
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Slides of my talk at adaptTop 2013, "Automated self-testing and health check of live Sling instances". The use cases are similar to my previous presentation at CQCon, but the tool has been almost completely rewritten in the meantime. See http://sling.apache.org/documentation/bundles/sling-health-check-tool.html for more info on the Sling health check tools.
Citation preview
Automated self-testing and health checkof live Sling instances
Bertrand DelacrétazSling committer, ASF Member and (current) DirectorSenior Developer, Adobe CQ R&D team, Basel@bdelacretaz - grep.codeconsult.chadaptTo() Berlin, September 2013slides revision 2013-09-24
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
How can you trust your current (fragile?) combination of OSGi bundles and configs?
It needs live TESTING.
2
picture: anitapeppers on morgue!le.com
what do we mean by
Health Checks?
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
HealthCheck APIs
4
public interface HealthCheck { Result execute();}
public class Result { public boolean isOk() ... public Status getStatus() ... public Iterator<ResultLog.Entry> iterator() ...}
HealthCheckOSGi services
Service props:name, MBean, tags
Webconsole, JMX
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Webconsole plugin/system/console/healthcheck
6
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Health Check MBeans
7
Service propsname, MBean, tags
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Health Checks as JMX processors
8
MBean
MBean
MBean
HC
HC
HC
using expressions likejmx.attribute('java.lang:type=ClassLoading', 'LoadedClassCount') > 10 && jmx.attribute('java.lang:type=Runtime', 'ManagementSpecVersion') > 1
Use cases
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Use cases
10
System status Configuration
Self-testPerformance
All bundles up?Initial content ready?Disk space ok?External services ok?Load within bounds? (for jobs)
Requests per second ok?Request duration ok?Free memory ok?Replication queues ok?
Security checklist ok?Default accounts disabled?Demo content removed?
Startup smoke tests?Keep history of results?
what do you get
Out of the box?
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Out of the box - core
12
JmxAttributeHealthCheck
ScriptableHealthCheck
CompositeHealthCheck
Single JMX attributes
Script(let)s in any languageusing BindingValuesProviders
Run other Health Checksbased on their tags
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Out of the box - support bundle
13
SlingRequestStatusHC
DefaultLoginsHealthCheck
Is my resource there?Including its scripts?
admin:admin -> fail?
current HC bundles:org.apache.sling.hc.coreorg.apache.sling.hc.supportorg.apache.sling.hc.webconsoleorg.apache.sling.hc.jmxorg.apache.sling.hc.samples
how do you write
Your own Health Checks?
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
Custom Health Checks
15
@Component(...policy=ConfigurationPolicy.REQUIRE, metatype=true)@Property(name=HealthCheck.NAME),@Property(name=HealthCheck.TAGS,unbounded=PropertyUnbounded.ARRAY),@Property(name=HealthCheck.MBEAN_NAME)@Service(value=HealthCheck.class)public class MyHealthCheck { public Result execute() { FormattingResultLog f = new FormattingResultLog(); ... if(badThings) f.warn(“Something happened with {}”, foo); return new Result(f); }}
Execute “quickly”, cache...
Sling health check tools - adaptTo() 2013 - Bertrand Delacretaz
That’s it - have fun!
16
JmxAttributeHealthCheck
ScriptableHealthCheck
CompositeHealthCheck
SlingRequestStatusHC
DefaultLoginsHealthCheck
@Service(value=HealthCheck.class)public class MyHealthCheck { ....generate a Result quickly}
Docs at sling.apache.org : bundles : health check.Discuss on the Sling dev list.
I’m @bdelacretaz - thanks!
JMX processors
Webconsole
APACHE SLING & FRIENDS TECH MEETUPBERLIN, 23-25 SEPTEMBER 2013