Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy issue for inserting images to documentation #9

Open
CarolinJaser opened this issue Mar 3, 2021 · 6 comments
Open

Dummy issue for inserting images to documentation #9

CarolinJaser opened this issue Mar 3, 2021 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@CarolinJaser
Copy link
Member

CarolinJaser commented Mar 3, 2021

Bildschirmfoto 2021-03-03 um 15 06 08

Bildschirmfoto 2021-03-03 um 15 05 51

@CarolinJaser CarolinJaser added the documentation Improvements or additions to documentation label Mar 3, 2021
@CarolinJaser CarolinJaser self-assigned this Mar 3, 2021
@kulla
Copy link
Member

kulla commented Mar 12, 2021

2021-03-12-145752_802x802_scrot
2021-03-12-145801_777x326_scrot
2021-03-12-145807_505x374_scrot

@kulla
Copy link
Member

kulla commented Mar 27, 2021

cache

@startuml

start

:compute cache key for request;

if (cache has value under computed cache key?) then (yes)
 :return value from cache;
else (no)
 :perform request;
 :save response in cache;
 :return response from request;
endif

stop

@enduml

@kulla
Copy link
Member

kulla commented Mar 27, 2021

listener

@startuml
actor user as user
participant "legacy serlo.org" as serlo
participant api.serlo.org as api
user -> serlo: Update something (taxonomy term, ...)
serlo -> api: Update cache entry "..." to "..."
serlo <- api: Done ✓
serlo -> api: Update cache entry "..." to "..."
serlo <- api: Done ✓
... updates as often as necessary ...
user <- serlo: Done ✓
@enduml

@kulla
Copy link
Member

kulla commented Mar 27, 2021

swr

@startuml
actor user as user
box "api.serlo.org"
participant resolver as resolver
participant "data source" as datasource
database cache as cache
queue "swr queue" as queue
participant "swr worker" as worker
endbox
database service as service

== When a GraphQL query is made ==

user -> resolver: make GraphQL query
resolver -> resolver: calculate necessary ressource(s) to perform query
group for each ressource
resolver -> datasource: request ressource R
datasource -> datasource: calculate cache key K for ressource R
datasource -> cache: get value and it's age for key K
datasource <- cache: return value and it's age
datasource -> datasource: Is cache entry older than specified max age?
datasource -> queue: If yes: put cache key K on queue
resolver <- datasource: return old value from cache
end
user <- resolver: return response for GraphQL query

== In parallel: Algorithm for the SWR worker ==

group endless loop
queue <- worker: get oldest cache key and delete it
queue -> worker: cache key K
worker -> worker: calculate which request need to be done to update K
worker -> service: get current value for K
worker <- service: return current value
cache <- worker: Save current value for cache key K
end

@enduml

@CarolinJaser
Copy link
Member Author

Bildschirmfoto 2021-03-30 um 11 02 08

@CarolinJaser
Copy link
Member Author

Bildschirmfoto 2021-03-31 um 18 28 58

@elbotho elbotho transferred this issue from serlo/api.serlo.org Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants