Oak, the architecture of Apache Jackrabbit 3
-
Upload
jukka-zitting -
Category
Software
-
view
1.717 -
download
6
description
Transcript of Oak, the architecture of Apache Jackrabbit 3
![Page 1: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/1.jpg)
Oakthe architecture of Apache Jackrabbit 3
![Page 2: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/2.jpg)
Subsection TitleSubsection Title• Text• Text• Text• Text
![Page 3: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/3.jpg)
Resources
• http://jackrabbit.apache.org/oak/• Docs
• http://jackrabbit.apache.org/oak/docs/• Code
• https://svn.apache.org/repos/asf/jackrabbit/oak/trunk/• https://github.com/apache/jackrabbit-oak
• Builds• http://ci.apache.org/builders/oak-trunk/• https://travis-ci.org/apache/jackrabbit-oak
![Page 4: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/4.jpg)
Outline• Tree model• Updating the tree• Refresh and garbage collection• Concurrency and conflicts• Interlude: Implementations• Replicas and sharding• Access control• Comparing revisions• Commit hooks• Observers• Search• Big picture
![Page 5: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/5.jpg)
Tree model
![Page 6: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/6.jpg)
a d
b c
Paths as identifiers//a/a/b/a/c/d
![Page 7: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/7.jpg)
a d
b c
Paths as identifiers//a/a/b/a/c/d
![Page 8: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/8.jpg)
Updating the tree
![Page 9: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/9.jpg)
?
![Page 10: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/10.jpg)
r1 r2
HEAD
r1: /d r2: /d
r1: /a/cr2: /a/c
![Page 11: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/11.jpg)
Refresh and garbage collection
![Page 12: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/12.jpg)
refresh
![Page 13: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/13.jpg)
garbage
![Page 14: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/14.jpg)
![Page 15: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/15.jpg)
Concurrency and conflicts
![Page 16: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/16.jpg)
r1 r2br2a
![Page 17: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/17.jpg)
r1
r2b
r2a
r3merge
![Page 18: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/18.jpg)
Conflict handling strategiesa. Fully serialized commits
• fail on conflict, no concurrent updates
b. Partially serialized commits• fail on conflict, concurrent conflict-free updates
c. Partial merge logic• conflict markers, manual conflict resolution
d. Full merge logic• conflicting changes may be lost
![Page 19: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/19.jpg)
Interlude: implementations
![Page 20: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/20.jpg)
MicroKernel/NodeStore
• Implementation of the tree/revision model
Responsible for
Clustering
Sharding
Caching
Conflict handling
etc.
Not responsible for
Type validation
Access control
Search
Versioning
etc.
![Page 21: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/21.jpg)
Current implementations
DocumentMK TarMK (SegmentMK)
Persistence backends MongoDB, JDBC (WIP) Local FS (tar files)
Conflict handling Partial serialization Full serialization
Clustering MongoDB clustering Simple failover
Sharding MongoDB sharding N/A
Single-node performance Moderate High
Key use cases Large deployments (>1TB), concurrent writes
Small/medium deployments, mostly read
![Page 22: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/22.jpg)
Replicas and sharding
![Page 23: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/23.jpg)
master copy full replica cache
Replicas and caches
![Page 24: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/24.jpg)
by path by level by hash
Sharding strategies
with caching
![Page 25: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/25.jpg)
Access control
![Page 26: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/26.jpg)
Accessible paths//a/b/d
![Page 27: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/27.jpg)
Existentialism
• All (syntactically valid) paths can be traversed
• But the identified node might not exist• For example:
root.getChildNode(“a”).exists() -> false
root.getChildNode(“a”).getChildNode(“b”).exists() -> true!
• Implemented as a decorator over the MK
![Page 28: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/28.jpg)
Comparing revisions
![Page 29: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/29.jpg)
What changed?
![Page 30: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/30.jpg)
Content diff
• Tells what changed between two content trees• Cornerstone of most higher-level functionality• validation• indexing• observation• etc.
![Page 31: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/31.jpg)
r1
r2b
r2a
r3
Examples
r1 -> r3“a” modified
“b” removed“d” modified
“e” added
r1 -> r2a“a” modified
“b” removed
r1 -> r2b“d” modified
“e” added
![Page 32: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/32.jpg)
Commit hooks
![Page 33: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/33.jpg)
If this changed, commit this instead
![Page 34: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/34.jpg)
Commit hooks
• Based on given before and after states, a hook can:• fail the commit, or• pass the commit unmodified, or• pass the commit with modifications
• Key plugin mechanism in Oak• All configured hooks are applied in sequence• Used for much higher level functionality
• Often implemented using a content diff
![Page 35: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/35.jpg)
Examples
• All kinds of validation• node types, access control, references, etc.
• Trigger-like functionality• autocreated content, default values, etc.
• In-content index updates• etc.
![Page 36: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/36.jpg)
Types of hooks
CommitHook Editor Validator
Content diff Optional Always Always
Can modify commit Yes Yes No
Programming model
Simple Callbacks Callbacks
Performance impact
High Medium Low
![Page 37: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/37.jpg)
Observers
![Page 38: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/38.jpg)
Observers
• Based on given before and after states, an observer can:• observe what changed in the content tree
• Invoked after the commit, unlike commit hooks• Always asynchronous for changes from other cluster
nodes• Depending on backend, can be synchronous for
changes on the local cluster node• Often implemented using a content diff
![Page 39: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/39.jpg)
Examples
• JCR Observation• External index updates• Cache invalidation• Logging• etc.
![Page 40: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/40.jpg)
Search
![Page 41: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/41.jpg)
SELECTWHERE x=y
/a//*
Parser
Parser
ParserIndex
Index
Index
Parser Index
Query engine
![Page 42: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/42.jpg)
Query processing steps
1. Parsinga. Select matching parserb. Parse the query string
2. Executiona. Estimate cost per indexb. Select index with the least cost estimatec. Execute the query against the index
3. Post-processinga. Filter results on access control and additional constraintsb. Apply sorting, grouping, faceting, etc.
![Page 43: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/43.jpg)
Index implementations
• Property index• Reference index• Lucene index• in-content• local file system
• Solr index• embedded• external
![Page 44: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/44.jpg)
Big picture
![Page 45: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/45.jpg)
MicroKernel
Oak Core
Oak JCR
Oak API
NodeStore API
JCR API
Plugins
![Page 46: Oak, the architecture of Apache Jackrabbit 3](https://reader038.fdocuments.us/reader038/viewer/2022102620/541032328d7f727c0c8b4614/html5/thumbnails/46.jpg)
Questions?