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

add plantuml document for a paging optimizations using a cache #463

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/plantuml/paging/paging_endpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions docs/plantuml/paging/paging_endpoint.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
@startuml
'https://plantuml.com/sequence-diagram

actor Client as "Client"
control ReverseProxy as "Server Cache"
group Session [Client 1]
Client -> ReverseProxy: /catalog/timeseries/pages?office=SWT
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /catalog/timeseries/pages?office=SWT
CDA -> Database: offset/keyset/etc pagination query
CDA -> ReverseProxy: cache
CDA -> Client: \n \
/catalog/timeseries?office=SWT&tsid_start=<1>&tsid_end=<2>\n \
/catalog/timeseries?office=SWT&tsid_start=<3>&tsid_end=<4>\n \
/catalog/timeseries?office=SWT&tsid_start=<5>&tsid_end=<6>\n
par thread 1
Client -> ReverseProxy: /catalog/timeseries?office=SWT&tsid_start=<1>&tsid_end=<2>
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /catalog/timeseries?office=SWT&tsid_start=<1>&tsid_end=<2>
CDA -> Database: query time series for SWT starting with <1> and ending with <2>
CDA -> Client: time series ids
else thread 2
Client -> ReverseProxy: /catalog/timeseries?office=SWT&tsid_start=<3>&tsid_end=<4>
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /catalog/timeseries?office=SWT&tsid_start=<3>&tsid_end=<4>
CDA -> Database: query time series for SWT starting with <3> and ending with <4>
CDA -> Client: time series ids
else thread 3
Client -> ReverseProxy: /catalog/timeseries?office=SWT&tsid_start=<5>&tsid_end=<6>
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /catalog/timeseries?office=SWT&tsid_start=<5>&tsid_end=<6>
CDA -> Database: query time series for SWT starting with <5> and ending with <6>
CDA -> Client: time series ids
end
else Session 2
Client -> ReverseProxy: /catalog/timeseries/pages?office=SWT
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: yes
ReverseProxy -> Client: \n \
/catalog/timeseries?office=SWT&tsid_start=<1>&tsid_end=<2>\n \
/catalog/timeseries?office=SWT&tsid_start=<3>&tsid_end=<4>\n \
/catalog/timeseries?office=SWT&tsid_start=<5>&tsid_end=<6>\n
par thread 1
Client -> ReverseProxy: /catalog/timeseries?office=SWT&tsid_start=<1>&tsid_end=<2>
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: yes
ReverseProxy -[#green]> Client: time series ids
else thread 2
Client -> ReverseProxy: /catalog/timeseries?office=SWT&tsid_start=<3>&tsid_end=<4>
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: yes
ReverseProxy -[#green]> Client: time series ids
else thread 3
Client -> ReverseProxy: /catalog/timeseries?office=SWT&tsid_start=<5>&tsid_end=<6>
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: yes
ReverseProxy -[#green]> Client: time series ids
end
end

footer Green arrow indicates performance improvement due to caching
@enduml
Binary file added docs/plantuml/paging/smart_paging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions docs/plantuml/paging/smart_paging.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@startuml
'https://plantuml.com/sequence-diagram

actor Client as "Client"
control ReverseProxy as "Server Cache"
group Session [Client 1]
Client -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>/pages?begin=2023-11-05T00:00:00-0700[UTC]&end=current
CDA -> CDA: calculate pages based on interval
CDA -> Client: \n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T12:00:00-0700[UTC]&end=2023-11-10T13:53:00-0700[UTC]\n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T00:00:00-0700[UTC]&end=2023-11-10T12:00:00-0700[UTC]\n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-05T00:00:00-0700[UTC]&end=2023-11-10T00:00:00-0700[UTC]\n
par thread 1
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T12:00:00-0700[UTC]&end=2023-11-10T13:53:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T12:00:00-0700[UTC]&end=2023-11-10T13:53:00-0700[UTC]
CDA -> Database: query time series for SWT ACTT2.Elev.Inst.1Hour.0.Ccp-Rev\nstarting with 2023-11-10T12:00:00-0700[UTC] \n ending with 2023-11-10T13:53:00-0700[UTC]
CDA -> Client: time series data
else thread 2
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T00:00:00-0700[UTC]&end=2023-11-10T12:00:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T00:00:00-0700[UTC]&end=2023-11-10T12:00:00-0700[UTC]
CDA -> Database: query time series for SWT ACTT2.Elev.Inst.1Hour.0.Ccp-Rev\nstarting with 2023-11-10T00:00:00-0700[UTC] \n ending with 2023-11-10T12:00:00-0700[UTC]
CDA -> Client: time series data
else thread 3
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-05T00:00:00-0700[UTC]&end=2023-11-10T00:00:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-05T00:00:00-0700[UTC]&end=2023-11-10T00:00:00-0700[UTC]
CDA -> Database: query time series for SWT ACTT2.Elev.Inst.1Hour.0.Ccp-Rev\nstarting with 2023-11-05T00:00:00-0700[UTC] \n ending with 2023-11-10T00:00:00-0700[UTC]
CDA -> Client: time series data
end
else Session 2
Client -> Database: data stored event for SWT ACTT2.Elev.Inst.1Hour.0.Ccp-Rev at 2023-11-10T13:00:00-0700[UTC]
else Session 3
Client -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>/pages?begin=2023-11-01T00:00:00-0700[UTC]&end=current
CDA -> CDA: calculate pages based on interval
CDA -> Client: \n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T12:00:00-0700[UTC]&end=2023-11-10T13:53:00-0700[UTC]\n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T00:00:00-0700[UTC]&end=2023-11-10T12:00:00-0700[UTC]\n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-05T00:00:00-0700[UTC]&end=2023-11-10T00:00:00-0700[UTC]\n \
/timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-01T00:00:00-0700[UTC]&end=2023-11-05T00:00:00-0700[UTC]\n
par thread 1
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T12:00:00-0700[UTC]&end=2023-11-10T13:53:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T12:00:00-0700[UTC]&end=2023-11-10T13:53:00-0700[UTC]
CDA -> Database: query time series for SWT ACTT2.Elev.Inst.1Hour.0.Ccp-Rev\nstarting with <1> \n ending with <2>
CDA -> Client: time series data
else thread 2
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-10T00:00:00-0700[UTC]&end=2023-11-10T12:00:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: yes
ReverseProxy -[#green]> Client: time series data
else thread 3
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-05T00:00:00-0700[UTC]&end=2023-11-10T00:00:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: yes
ReverseProxy -[#green]> Client: time series data
else thread 4
Client -> ReverseProxy: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-01T00:00:00-0700[UTC]&end=2023-11-05T00:00:00-0700[UTC]
ReverseProxy -> CDA: cache current?
CDA -> ReverseProxy: no
ReverseProxy -> CDA: /timeseries/<ACTT2.Elev.Inst.1Hour.0.Ccp-Rev>?office=SWT&begin=2023-11-01T00:00:00-0700[UTC]&end=2023-11-05T00:00:00-0700[UTC]
CDA -> Database: query time series for SWT ACTT2.Elev.Inst.1Hour.0.Ccp-Rev\nstarting with 2023-11-01T00:00:00-0700[UTC] \n ending with 2023-11-05T00:00:00-0700[UTC]
CDA -> Client: time series data
end
end

footer For this example "current" time is 2023-11-10T13:53:00-0700[UTC] \n\n \
Green arrow indicates performance improvement due to caching
@enduml
Loading