[Brainstorm] Caching Data to increase performance, responsiveness and decrease network cost.
Background:
Sunbird platform is build on micro-service architecture, and has different service layers. Sunbird client application request data from different service based on requirement. Request goes through multiple service layer before its served by service. This increases network overhead and load on services. Sunbird doesn't have proper caching mechanism in place to server different request from clients.
Solutions:
Client request that can be cached can be broadly classified into below categories.
1. Static Assets:
Contains all the js, css, images, fonts etc.. These are either served from CDN or cached at Proxy. No changes required here.
Tenant Folder need to be cached at Proxy to avoid load on Portal backend.
2. Master Data:
Master Data are the resources that doesn't change often and are maintained by Admin. Below list contain most commonly used API’s
API | Method | Cached | Cached @ Portal |
---|---|---|---|
Framework Read | GET | Yes @ Proxy | No |
Channel Read | GET | Yes @ Proxy | No |
System Setting Read | GET | Yes @ Proxy | No |
Resource Bundle Read | GET | Yes @ Proxy | No |
Role Read | GET | Yes @ Proxy | No |
Org Search | POST | Yes @ Proxy | No |
Form Read | POST | No | No |
Location Search | POST | No | No |
Most of the API are cached at Proxy server with a TTL of 1 Hour. This reduces load on server. But client still have to make request to get the data. These data should also be cached at client for some period of time. This can be achieved by using cache control headers. Proxy Server can be configured to send these header for all response.
3. User State:
This are the API’s that help maintain user data across clients. Below table list user state API’s