[PR #3580] [MERGED] Improve cover image performance #4022

Closed
opened 2026-04-25 00:18:00 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/3580
Author: @mikiher
Created: 11/2/2024
Status: Merged
Merged: 11/2/2024
Merged by: @advplyr

Base: masterHead: cover-image-performance


📝 Commits (6)

  • 431ae97 add Database.getLibraryItemCoverPath
  • 9e990d7 Optimize LibraryItemController.getCover
  • 4224b8a No auth and req.user for cover images
  • c25acb4 Remove token from cover image urls
  • 7a1623e Move cover path func to LibraryItem model
  • 7a49681 Fix includes

📊 Changes

6 files changed (+80 additions, -45 deletions)

View changed files

📝 client/store/globals.js (+2 -2)
📝 server/Auth.js (+20 -0)
📝 server/Server.js (+7 -7)
📝 server/controllers/LibraryItemController.js (+11 -30)
📝 server/managers/CacheManager.js (+13 -6)
📝 server/models/LibraryItem.js (+27 -0)

📄 Description

Following the experiments described here, I made the following changes to cover image GET requests (I will do the same for author images in separate PR - wanted to focus on covers here):

  • Removed authentication and user deserialization (req.user) from cover requests
  • Optimized LibraryItemController.getCover so that no database access is made if the resized image is already in the covers disk cache
  • Removed the token parameter from cover urls on the web client

This reduces the average completion time for cover requests by a factor of ~10 when acessing the server through https, and minimizes concurrent access to the database.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/3580 **Author:** [@mikiher](https://github.com/mikiher) **Created:** 11/2/2024 **Status:** ✅ Merged **Merged:** 11/2/2024 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `cover-image-performance` --- ### 📝 Commits (6) - [`431ae97`](https://github.com/advplyr/audiobookshelf/commit/431ae97593da6930e5a9be0bed126f5afc8e135d) add Database.getLibraryItemCoverPath - [`9e990d7`](https://github.com/advplyr/audiobookshelf/commit/9e990d79272f05ef79415d5b94835787d25200cd) Optimize LibraryItemController.getCover - [`4224b8a`](https://github.com/advplyr/audiobookshelf/commit/4224b8a486b106d8c26185a5f24253a0d4587975) No auth and req.user for cover images - [`c25acb4`](https://github.com/advplyr/audiobookshelf/commit/c25acb41fa9a6302e9d3e1261c5da38ef4a7a499) Remove token from cover image urls - [`7a1623e`](https://github.com/advplyr/audiobookshelf/commit/7a1623e6a11307842060360bac97ee10256548f9) Move cover path func to LibraryItem model - [`7a49681`](https://github.com/advplyr/audiobookshelf/commit/7a49681dd205ec36a8b083cdaee1cf8e6c78d1e2) Fix includes ### 📊 Changes **6 files changed** (+80 additions, -45 deletions) <details> <summary>View changed files</summary> 📝 `client/store/globals.js` (+2 -2) 📝 `server/Auth.js` (+20 -0) 📝 `server/Server.js` (+7 -7) 📝 `server/controllers/LibraryItemController.js` (+11 -30) 📝 `server/managers/CacheManager.js` (+13 -6) 📝 `server/models/LibraryItem.js` (+27 -0) </details> ### 📄 Description Following the experiments described [here](https://github.com/advplyr/audiobookshelf/discussions/3570), I made the following changes to cover image GET requests (I will do the same for author images in separate PR - wanted to focus on covers here): - Removed authentication and user deserialization (req.user) from cover requests - Optimized `LibraryItemController.getCover` so that no database access is made if the resized image is already in the covers disk cache - Removed the token parameter from cover urls on the web client This reduces the average completion time for cover requests by a factor of ~10 when acessing the server through https, and minimizes concurrent access to the database. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:18:00 +02:00
adam closed this issue 2026-04-25 00:18:00 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4022