18
Enhancing Adobe Experience Manager (CQ5) with Varnish Dan Beldiman, Senior System Engineer 28. November 2013

Enhancing Adobe Experience Manager (CQ5) with Varnish · [email protected] Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

Enhancing Adobe Experience Manager (CQ5) with Varnish

Dan Beldiman, Senior System Engineer 28. November 2013

Page 2: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

About netcentric

Founded 2012 focused on Web Experience Projects

80 Employees inMünchen, Zürich, London und Barcelona

Focus onAdobe CQ5

2

Page 3: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

AGEN

DA

1 Adobe Experience Manager (AEM)

2 Caching with AEM

3 Varnish with AEM

4 Q & A

Page 4: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

1 ADOBE EXPERIENCE MANAGER

Page 5: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

What is Adobe Experience Manager (AEM)?

An easy-to-use unified web content management solution

Create, and deliver personalized online experiences

Formerly known as "CQ5"

5

Page 6: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

Easy to use, great look and feel

6

Page 7: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

AEM technical setup: The big picture

Content Replication

Request content from web server

Via load- balancer

If not cached, request content from Publish

Content request form web- server with dispatcher cache

Author Surfer

Publish

Author Load

Balancer

Web Server

Publish Web Server

7

Page 8: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

AEM technical setup: How cache flushing works

Apache Webserver

CQ5 Publisher

Docroot

Web request

Dispatcher Module

Request from CQ if not in cache

Page activation

Local cache

Cache Flush request

GET/dispatcher/ invalidate.cache HTTP/1.1"

CQ-Path: /content/mysite/mypage"

8

Page 9: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

2 CACHING WITH AEM

Page 10: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

AEM Caching module: Dispatcher

A Web server module for Apache httpd, Microsoft IIS and others

Stores cachable objects in the docroot

Basic flushing & invalidation support

Support for multiple virtual hosts

10

Page 11: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

How the Dispatcher returns documents

11

Source: https://dev.day.com/docs/en/cq/current/deploying/dispatcher.html

If not cachable, return document

If cachable, put document into cache

Yes, take document from cache

Yes

Yes

No

No

No

Is the request cachable?

Is it cached?

Is it up to date?

Render the document

Document request

Document

DISPATCHER

CACHE

Page 12: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

Why change the Dispatcher?

Due to it's nature it can only cache the body of a response § No redirects

As the request handling is done by the underlying web server, concurrency is a big issue § Multiple requests to the same complex pages

Rules for high-traffic or complex pages cannot easily be configured § Workarounds using RewriteRules…

12

Page 13: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

Why Varnish?

Because Varnish is awesome J

Caching and flushing can be defined fine grained §  Logic of content references can be built into flush rules

Is fast and reliable § Used in Intranet where CDN is not an option for web acceleration

Caching of non-html responses is possible § Caching of redirects

13

Page 14: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

3 VARNISH WITH AEM

Page 15: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

CQ5 Technical setup: publishing details using varnish

CQ5 Publisher

Varnish

Apache Webserver

Request from CQ if not in cache

Web request

Page activation

Cache Flush request

15

Page 16: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

What does it take for a basic integration?

if (req.url == "/dispatcher/invalidate.cache"){ if(req.http.CQ-Handle){ ban("obj.http.x-url ~ ^"+req.http.CQ-Handle+"[^/]*$"); std.log("Banning: "+"obj.http.x-url ~ ^"+req.http.CQ-Handle+"[^/]*$"); }

}

Literally one condition with a ban statement …

16

Page 17: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

What else can we achieve?

Improve flushing/ invalidation through specific rules

Change flush behaviour dynamically

Control cache through the admin interface

17

Page 18: Enhancing Adobe Experience Manager (CQ5) with Varnish · dan.beldiman@netcentric.biz Tel: +49 170 5844847 Landsberger Strasse 110 Central Tower 80339 Munich 18 Dan Beldiman Netcentric

[email protected] Tel: +49 170 5844847

Landsberger Strasse 110Central Tower80339 Munich

18

Dan Beldiman

Netcentric Deutschland GmbH

Poststrasse 58805 Pfäffikon

Netcentric AG

Avenida Diagonal 1238ª Planta08005 Barcelona

Netcentric Iberia S.L.

Nordstrasse 98006 Zurich

Holland HouseGherkin Piazza, 1 – 4 Bury StreetLondonEC3A 5AW

Netcentric UK Limited

Q A

Contact