Upload
harald-schult-ulriksen
View
296
Download
2
Embed Size (px)
Citation preview
Personalisering av http://tv.nrk.no
Harald Schult Ulriksen@hsulriksen
http://aurum.no
Utgangspunkt
Utgangspunkt
Bunntekst/Presentasjonstittel 7
Klikk ikonet for å legge til et bilde
CC BY Gemma Longman
Ytelse Oppetid Tilstand Sikkerhet
Kø
Kø
Kø
Topic
Subscription A
Subscription B
Topic
V2
West Europe v1
West Europe v2
North Europe V2
North Europe V1
WorkerRole
WorkerRole
WorkerRole
WorkerRole
Patterns• Command Query Responsibility Segregation• Queue-based Load Leveling• Competing consumers• Publish subscribe channel• Content based router• Deadletter• Message store
APIRedis Cache
Redis CacheAPI
Kø
Datasenter 1
Datasenter 2
Kø
Datasenter 1
Datasenter 2
Kø leser
DocumentDb
Kø leser
DocumentDb
Datasenter 1 Datasenter 2
1
3
2
1
2
1
1
1
2
3
DocumentDb
Scaling DocumentDbRequest units
S2
S1
S0 2501000 + 1000 + 1000 + 1000 + 1000 + 1000
= 6000
Request unitsS0 250 kr 177,00 S1 1000 kr 353,00 S2 2500 kr 706,00
Sekunder mellom hver ping S1 RU's 1000 120,00 Antall 10,00 kr 3 530,00
API klienter Request pr. minutt Pr. sekund MS pr melding RU's needed RU's total RU Balance 100 000,00 50 000,00 833,33 1,20 10 791,67 10 000,00 -791,67 50 000,00 25 000,00 416,67 2,40 5 395,83 10 000,00 4 604,17 20 000,00 10 000,00 166,67 6,00 2 158,33 10 000,00 7 841,67 10 000,00 5 000,00 83,33 12,00 1 079,17 10 000,00 8 920,83
Request charge
Save recently watched Document lookup 2,28 Replace existing 10,67 Total 12,95
Redis cache structure
Name Type Key / Score DataPlo Hashset ProgramId Program list itemsp_{seriesId} Set ProgramIdsuf_{userId} Hashset ProgramId Serialized datausf_{userId} SortedSet Unix epoch date added ProgramId
uh_{userId} Hashset ProgramId Serialized dataush_{userId} SortedSet Unix epoch, last
watchedProgramId
User loaded ul_{userId} BoolUser last write time uw_{userId} Date time
Script to load user data