52
PUSHING UMBRACO TO THE LIMITS While building New Heroes

Pushing umbraco to the limits

  • Upload
    dawoe

  • View
    102

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Pushing umbraco to the limits

PUSHING UMBRACO TO THE LIMITS

While building New Heroes

Page 2: Pushing umbraco to the limits

• Lead developer @coloursinternet• Umbraco MVP 2016/2017• Working with Umbraco since late 2007 (v3)

Dave Woestenborghs @dawoe21

• Senior Developer @coloursinternet• 3 times Umbraco MVP• Working with Umbraco since 2009 (v4)• Was looking for a job last year during CG.

Since than only been working on this project.

Jeroen Breuer@j_breuer

INTR

OD

UCT

ION

Page 3: Pushing umbraco to the limits

Pushing umbraco to the limits

THE AGENDA1. What is New Heroes2. Statistics3. Load balance setup4. 1-1 multilingual5. Database access6. Miniprofiler7. Performance tweaking8. Pluginmanager9. Other techniques10. Questions

Page 4: Pushing umbraco to the limits

NEW HEROESNew Heroes is an online platform that allows access to soft skills and leadership training for anyone , anytime and anywhere in the world .

Through the platform , users can continue develop in the areas of communication, personal empowerment and leadership.

Page 5: Pushing umbraco to the limits

5

NEW HEROES

For a fixed and low monthly amount, both individuals and businesses, have unlimited usage of all trainings , also known as 'learning journeys ' .

01

Page 6: Pushing umbraco to the limits

VID

EO

Page 7: Pushing umbraco to the limits

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS 02The statistics

• Lines of code : 69k• Git commits : 7500+• Community property editors : 4• Community tools : 7• Custom build property editors : 1

STATS CODE

Page 8: Pushing umbraco to the limits

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS 02The statistics

• Umbraco Version : 7.3.8 (started on 7.3.0-beta1)• Number of media items : 1263• Number of content items : 8411• Number of cache instructions : +37k• Number of doctypes : 205

STATS UMBRACO

Page 9: Pushing umbraco to the limits

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS 02The statistics

• Number of times that Jeroen deleted the wrong doctype : 2

STATS MISTAKES

Page 10: Pushing umbraco to the limits

Development goals

• Application should autoscale• Use core/community functionality where possible • Focus on performance• DRY backend and front end• 1-1 multilingual for reusable content

OUR GOALS

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 11: Pushing umbraco to the limits

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS 03Load balance setup

• Hosted on Azure (Blob storage / redis cache)• VM with editors environment (master)• Front end runs on auto scaling web app (slaves)• Started on 7.3 beta because of the flexible loadbalancing

(no config for loadbalancing needed)• But you need to have some config tweaks. So make sure

you read the loadbalancing docs on our.umbraco.org

LOADBALANCED

Page 12: Pushing umbraco to the limits

12

LOAD

BALA

NCE

D • Use correct events to update custom cache (e.g. output cache)

• Published event is only executed on the server where it’s triggered. Not on all other servers.

• Hook in to CacheRefreshers CacheUpdated event instead. PageCacheRefresher.CacheUpdated += (sender, args) =>{ { // clear cache here };

Page 13: Pushing umbraco to the limits

13

LOAD

BALA

NCE

D • For custom needs it’s possible to create your own cache refreshers .

• Need to create a class that implements ICacheRefresher interface.

• Umbraco has some base classes that you can inherit from like CacheRefresherBase and JsonCacheRefresherBase

• When your data is changed tell the distributed cache that it needs to execute a method on the cacherefresher :

• DistributedCache.Instance.RefreshAll(CustomCacheRefresherGuid);

• And handle the CacheUpdated event for the cache refresher

Page 14: Pushing umbraco to the limits

0414

1-1 multilingual

MULTILINGUAL SETUP

Page 15: Pushing umbraco to the limits

15

MU

LTIL

ING

UAL

SETU

P

• Still uses a separate language tree• Nodes that need to be reused in a shared data folder.• Uses a UrlProvider and ContentFinder.• Vorto for the 1-1 properties• Nested Content to create fieldsets• ModelsBuilder for strongly typed fieldsets.• http://24days.in/umbraco/2015/multilingual-vorto-nested-

content/

Page 16: Pushing umbraco to the limits

16

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 17: Pushing umbraco to the limits

17

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 18: Pushing umbraco to the limits

18

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 19: Pushing umbraco to the limits

19

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 20: Pushing umbraco to the limits

20

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 21: Pushing umbraco to the limits

21

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 22: Pushing umbraco to the limits

22

REN

DER

Page 23: Pushing umbraco to the limits

23

MO

DEL

S BU

ILD

ER

Page 24: Pushing umbraco to the limits

24

URL

PRO

VID

ER

Page 25: Pushing umbraco to the limits

25

CON

TEN

T FI

ND

ER

Page 26: Pushing umbraco to the limits

05Database access

• Needed custom database tables for storing user data• Needed to select a ORM• Decided to go with PetaPoco because it ships with

Umbraco.

DATABASE ACCESS

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 27: Pushing umbraco to the limits

27

EXAM

PLE

POCO

Page 28: Pushing umbraco to the limits

28

CRU

D O

PERA

TIO

NS

Page 29: Pushing umbraco to the limits

29

Database access

• Goal was to do database maintenance (creating, modifying tables) from code so that it becomes part of the automated build process.

• We’re using uSync for all Umbraco parts.

MAINTENANCE

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 30: Pushing umbraco to the limits

30

PETA

PO

CO A

TTEM

PT

Page 31: Pushing umbraco to the limits

31

• Only possible to create and drop tables• No ways to alter tables, add constraints and indexes• Needed an alternative

PETA POCO ATTEMPT

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Database access

Page 32: Pushing umbraco to the limits

32

• Migrations is used by Umbraco process• Have been in place since 6.0.0• Open to the general public since 7.3.0

MIGRATIONS

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Database access

Page 33: Pushing umbraco to the limits

33

MIG

RATI

ON

S

Page 34: Pushing umbraco to the limits

34

MIG

RATI

ON

S

Page 35: Pushing umbraco to the limits

35

MIG

RATI

ON

S

Page 36: Pushing umbraco to the limits

36

MIG

RATI

ON

S

Page 37: Pushing umbraco to the limits

0737

Miniprofiler

PERFORMANCEMINIPROFILER

Page 38: Pushing umbraco to the limits

38

LOG

GIN

G E

XECU

TIO

N T

IME

Page 39: Pushing umbraco to the limits

39

LOG

GIN

G E

XECU

TIO

N T

IME

Page 40: Pushing umbraco to the limits

40

LOG

GIN

G E

XECU

TIO

N T

IME

Page 41: Pushing umbraco to the limits

41

MVC

WIT

H H

TML.

ACTI

ON

Page 42: Pushing umbraco to the limits

42

MVC

WIT

H H

TML.

ACTI

ON

Page 43: Pushing umbraco to the limits

43

EXAM

INE

Page 44: Pushing umbraco to the limits

44

DAT

ABAS

E

Page 45: Pushing umbraco to the limits

07Pluginmanager

Whenever types need to be found in assemblies in order to add them to resolvers, the PluginManager should be used. The TypeFinder should never be used directly in any code except for in PluginManager extension methods or in the PluingManager itself.• PluginManager.Current.ResolveTypes<T>• PluginManager.Current.ResolveAttributedTypes<T>()• PluginManager.Current.ResolveTypesWithAttribute<T,S>

PLUGINMANAGER

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 46: Pushing umbraco to the limits

Pluginmanager

A Resolver is an class that returns a plugin object or multiple plugin objects. There are 2 types of Resolvers: A single object resolver and a multiple object resolver.Some examples :Single object resolver : DefaultRenderMvcControllerResolver.CurrentMultiple object resolver : UrlProviderResolver.Current

OBJECTRESOLVERS

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 47: Pushing umbraco to the limits

47

EXAM

PLE

Page 48: Pushing umbraco to the limits

48

EXAM

PLE

Page 49: Pushing umbraco to the limits

49

EXAM

PLE

Page 50: Pushing umbraco to the limits

50

Pluginmanager

EXAMPLE• Only possible to create and drop tables• No ways to alter tables, add constraints and indexes• Needed an alternative

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 51: Pushing umbraco to the limits

51

09Other techniquesOTHER TECHNIQUES• Custom section with Angular + Umbraco WebApi +

PetaPoco• Virtual nodes• Service API (ContentService, MediaService,

RelationService)• ImageProcessor to resize images• Dependency Injection• Custom property value converters

PU

SH

ING

UM

BR

AC

O T

O T

HE

LIM

ITS

Page 52: Pushing umbraco to the limits

Pushing umbraco to the limits

QUESTIONS?