htrc / torchlite-backend

Backend API service for Torchlite web dashboard
2 stars 0 forks source link

Backend: caching data #111

Open jswatsch opened 2 months ago

sandeep-ps commented 1 month ago

Working on a first draft implementation of caching with https://github.com/long2ice/fastapi-cache and I'm currently testing the \/worksets endpoint.

sandeep-ps commented 1 month ago

Sharing initial results of caching when running things locally with Redis as the caching database. The below results are for the endpoint: GET /worksets/{{worksetId}}/metadata. I'm seeing a 55% reduction in the average response time. :-D

  1. With cache enabled Image
  2. With cache disabled Image

I will proceed with implementing this for different endpoints in the TORCHLITE backend. Please let me know if you have any questions or concerns. Thanks.

CC: @dkudeki, @gworthey

gworthey commented 1 month ago

That’s great news, Sandeep — thanks!

On Aug 1, 2024, at 1:36 PM, Sandeep Puthanveetil Satheesan @.***> wrote:

Sharing initial results of caching when running things locally with Redis as the caching database. The below results are for the endpoint: GET /worksets/{{worksetId}}/metadata. I'm seeing a 55% reduction in the average response time. :-D

  1. With cache enabled image.png (view on web)https://urldefense.com/v3/__https://github.com/user-attachments/assets/3143bf8f-3145-47c0-a79c-75a2db1c9810__;!!DZ3fjg!8Sto3zE_3bqOa3gMvNrex4dx-A67M2YBToatkfxaFtQpLinHCqsqdAJFX3sHSBLZjN39V8PNu0AytRgBIoAgLLDvgLoP$
  2. With cache disabled image.png (view on web)https://urldefense.com/v3/__https://github.com/user-attachments/assets/2d472031-7831-43c8-86ef-10af77a7af06__;!!DZ3fjg!8Sto3zE_3bqOa3gMvNrex4dx-A67M2YBToatkfxaFtQpLinHCqsqdAJFX3sHSBLZjN39V8PNu0AytRgBIoAgLAQrWkns$

I will proceed with implementing this for different endpoints in the TORCHLITE backend. Please let me know if you have any questions or concerns. Thanks.

CC: @dkudekihttps://urldefense.com/v3/__https://github.com/dkudeki__;!!DZ3fjg!8Sto3zE_3bqOa3gMvNrex4dx-A67M2YBToatkfxaFtQpLinHCqsqdAJFX3sHSBLZjN39V8PNu0AytRgBIoAgLD19SQqc$, @gwortheyhttps://urldefense.com/v3/__https://github.com/gworthey__;!!DZ3fjg!8Sto3zE_3bqOa3gMvNrex4dx-A67M2YBToatkfxaFtQpLinHCqsqdAJFX3sHSBLZjN39V8PNu0AytRgBIoAgLLXvw45L$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/htrc/torchlite-backend/issues/111*issuecomment-2263719700__;Iw!!DZ3fjg!8Sto3zE_3bqOa3gMvNrex4dx-A67M2YBToatkfxaFtQpLinHCqsqdAJFX3sHSBLZjN39V8PNu0AytRgBIoAgLNQpwhL2$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ABHCTSR725477THIBA7QHY3ZPJ54BAVCNFSM6AAAAABKXDVEXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRTG4YTSNZQGA__;!!DZ3fjg!8Sto3zE_3bqOa3gMvNrex4dx-A67M2YBToatkfxaFtQpLinHCqsqdAJFX3sHSBLZjN39V8PNu0AytRgBIoAgLOTHenet$. You are receiving this because you were mentioned.Message ID: @.***>

sandeep-ps commented 1 month ago

Adding more test results for future reference. This includes all GET requests in the TORCHLITE backend.

1. No cache (base case) Image 2. When cache is building Image 3. After cache building is complete, i.e., all requests are going through the cache. Image

jswatsch commented 1 week ago

@dkudeki is reviewing pull request as of 9/5/2024

jswatsch commented 4 days ago

@dkudeki added a patch for a bug related to internal API calls. The bug seems to be isolated to internal endpoint calls, not a broader problem with caching.

@sandeep can deploy it to the development stack