Upload
dawoe
View
102
Download
0
Embed Size (px)
Citation preview
PUSHING UMBRACO TO THE LIMITS
While building New Heroes
• 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
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
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.
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
VID
EO
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
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
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
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
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
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 };
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
0414
1-1 multilingual
MULTILINGUAL SETUP
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/
16
PU
SH
ING
UM
BR
AC
O T
O T
HE
LIM
ITS
17
PU
SH
ING
UM
BR
AC
O T
O T
HE
LIM
ITS
18
PU
SH
ING
UM
BR
AC
O T
O T
HE
LIM
ITS
19
PU
SH
ING
UM
BR
AC
O T
O T
HE
LIM
ITS
20
PU
SH
ING
UM
BR
AC
O T
O T
HE
LIM
ITS
21
PU
SH
ING
UM
BR
AC
O T
O T
HE
LIM
ITS
22
REN
DER
23
MO
DEL
S BU
ILD
ER
24
URL
PRO
VID
ER
25
CON
TEN
T FI
ND
ER
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
27
EXAM
PLE
POCO
28
CRU
D O
PERA
TIO
NS
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
30
PETA
PO
CO A
TTEM
PT
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
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
33
MIG
RATI
ON
S
34
MIG
RATI
ON
S
35
MIG
RATI
ON
S
36
MIG
RATI
ON
S
0737
Miniprofiler
PERFORMANCEMINIPROFILER
38
LOG
GIN
G E
XECU
TIO
N T
IME
39
LOG
GIN
G E
XECU
TIO
N T
IME
40
LOG
GIN
G E
XECU
TIO
N T
IME
41
MVC
WIT
H H
TML.
ACTI
ON
42
MVC
WIT
H H
TML.
ACTI
ON
43
EXAM
INE
44
DAT
ABAS
E
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
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
47
EXAM
PLE
48
EXAM
PLE
49
EXAM
PLE
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
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
Pushing umbraco to the limits
QUESTIONS?