11:40 Develop: Morgner - Graphdb for CMS

Preview:

DESCRIPTION

In this talk, I will show how CMS (Content Management Systems) benefit from using a Graph Database as storage layer by highlighting ten illustrative reasons. To support each statements, I will compare different Open Source CMS (including one Graph-CMS) regarding data model, persistence technology, cache layers and strategies, and show some performance numbers and diagrams. And as a historical sidenote, I will talk about Neo4j's CMS roots, enriched with some background information from the founders. Axel Morgner Axel is founder of structr—a free, open-source CMS and Content Management Framework based on the graph database Neo4j. He previously founded inxire GmbH, and was consultant and project manager at Oracle. After leaving the enterprise SQL world behind in 2010, he enjoys now being back to cutting egde technology every day. He’s based in Frankfurt/Main, Germany.

Citation preview

Ten Reasons WhyYou Should Use aGraph DatabaseFor Your CMS

GraphConnect, San Francisco, 6th Nov 2012Axel Morgner (@amorgner), founder of structr

About me

- 10+ yrs Oracle & ECM- founded inxire (ECM based on Oracle)- left 2010 to start over from scratch- met Peter Neubauer in Frankfurt- started structr

About structr- started as CMS/CMF- open sourced 31 May 2011- today: 0.6 about to be released

structr Server structr Ui

More info about structr

Website:http://structr.org

Source Code:https://github.com/structr/structr

Forum/Mailing List:https://groups.google.com/forum/#!forum/structr

Twitter:@structr

Ten Reasons ...

#1Graph Databaseswere made for

Content Management

Content Management

Content Management

Pages

Sites HTML Elements

Content Management

PicturesFiles

Pages

Sites HTML Elements

Texts

Content Management

Pictures

Videos

Sounds

Files

Folders

Users

Pages

Sites HTML Elements

Texts

Content Management

Pictures

Videos

Sounds

Files

Folders

Categories

Taxonomies

Terms

Users

GroupsRoles

Pages

Sites HTML Elements

Texts

Content Management

Pictures

Videos

Sounds

Files

Folders

Categories

Taxonomies

Terms

Users

GroupsRoles

Pages

Sites HTML Elements

Texts

Content Management

Pictures

Videos

Sounds

Files

Folders

Categories

Taxonomies

Terms

Users

GroupsRoles

Pages

Sites HTML Elements

Texts

CONTAINS

CONTAINS

CONTAINSACTS_IN

CONTAINS

LINK

LINK

CONTAINS

TAG

TAG

CONTAINS

IS_A

LINK

LINK CONTAINS

Neo4j wasinitially made for

Content Management

Q: What were the main reasons for you to create Neo4j?

A: We quickly saw that a part of the system was very "networky", and the relational database did not handle many-to-many relationships very well, and not even one-to-many relationships.

We ended up doing joins, and performance was very, very bad. So that's when we started to try different data models than the relational model, and see if we could use that to solve our business problems.

Q: All the CMS created at that time, in the early 2000s, were using an O/R mapping layer. So it was quite extra-ordinary that you did not go this way. What gave you the freedom to do that?A: We were young and naïve. :-) And we had a funding at that time, [...] so we decided to try it out. And here we are today.

Q: Permission resolution, was it a particular problem you were faced with?A: Oh yes, well, but we didn't see that at first. The actual problem we used as a starting point was the automatic translation between languages.

#1Graph Databases1

were made forContent Management2

1 at least Neo4j2 not exclusively

#2O/R Mapping

Core Data

Core Data

#2No O/R Mapping

=Less Code

Less Runtime ObjectsLess Complexity

#3Visualization

#3Graph Visualization

=Understand how your

data is connected

#4Schema

Content Graph

Pictures

Videos

Sounds

Files

Folders

Categories

Taxonomies

Terms

Users

GroupsRoles

Pages

Sites HTML Elements

Texts

CONTAINS

CONTAINS

CONTAINSACTS_IN

CONTAINS

LINK

LINK

CONTAINS

TAG

TAG

CONTAINS

IS_A

LINK

LINK CONTAINS

Domains as Sub Graphs

Pictures

Videos

Sounds

Files

Folders

Categories

Taxonomies

Terms

Users

GroupsRoles

Pages

Sites HTML Elements

Texts

CONTAINS

CONTAINS

CONTAINSACTS_IN

CONTAINS

LINK

LINK

CONTAINS

TAG

TAG

CONTAINS

IS_A

LINK

LINK CONTAINS

#4No Fixed Schema

=Flexibility

Late Optimization

#5Templates

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects O/R Layer

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data ObjectsTemplateEngine O/R Layer

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects O/R LayerTemplateEngine

WebServer

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects O/R LayerTemplateEngine

WebServer

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects O/R LayerTemplateEngine

WebServer

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects O/R LayerTemplateEngine

WebServer

Page Rendering<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=utf-8"/>

<title>${content.title!}</title>

</head>

<body>

<h1>${content.title!}</h1>

</body>

Page Template

Database

Data Objects O/R LayerTemplateEngine

WebServer

Page Rendering

RenderingEngine

WebServer

Page Rendering

Database:Content Graph

Data Objects:Content Graph

RenderingEngine

WebServer

#5No (classic) Templates

=Reduced Complexity

Less Caching

#6Caching

Caching Benchmark

0

12,5

25

37,5

50

req/s (w/o caching) 0

46

109

Wordpress 3.4.2 Drupal 7.16 structr 0.6 Apache

0

1000

2000

3000

4000

req/s (w/ caching)

3500

13191244

320

#6Less Caching

=Less Cache Sync./Invalid.

Less Cache Objects

#7Permission Resolution

ACLs

ACLs

ACLs

ACLs

#7Real-time ACL

Resolution=

Fast Access toProtected Content

#8Memory Footprint

#9Dependencies

#10Complex Features

Example: Versioning

Folder A

Document X

CONTAINS

Folder B

Document X

CONTAINS

t0 t1

Example: Versioning

Folder A

CONTAINS

Document X

Example: Versioning

Folder B

Document X

CONTAINS

Example: Versioning

Folder A

CONTAINS

Folder B

Document X

CONTAINS

valid_until: t1 valid_from: t1

Example: Versioning

Folder A

CONTAINS

Folder B

Document X

CONTAINS

valid_until: t1 valid_from: t1

User 1

SECURITYread: true

write: falsevalid_from: t2

SECURITYread: truewrite: true

valid_until: t2

Example: Versioning

Folder A

CONTAINS

Folder B

Document X

User 1

SECURITYread: truewrite: true

valid_until: t2

t0

Example: Versioning

Folder A Folder B

Document X

CONTAINS

User 1

SECURITYread: truewrite: true

t1

Example: Versioning

Folder A Folder B

Document X

CONTAINS

User 1

SECURITYread: true

write: false

t2

Conclusions

ConclusionsNo O/R mappingLess cachingEasy visualization

Simplicity

ConclusionsNo O/R mappingLess cachingEasy visualization

Real-time ACL resolutionSmaller memory footprintLess dependencies

Simplicity

Performance

ConclusionsNo O/R mappingLess cachingEasy visualization

Real-time ACL resolutionSmaller memory footprintLess dependencies

Complex features are easierNo (classic) templatesNo fixed schema

Simplicity

Performance

Flexibility

Graph Databaseswere made for

Content Management

Thank you!

Recommended