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

Improve author image performance #3584

Merged
merged 3 commits into from
Nov 3, 2024

Conversation

mikiher
Copy link
Contributor

@mikiher mikiher commented Nov 3, 2024

This is the same as PR #3580, for author images.

server/routers/ApiRouter.js Dismissed Show dismissed Hide dismissed
@mikiher mikiher marked this pull request as ready for review November 3, 2024 06:55
@nichwall
Copy link
Contributor

nichwall commented Nov 3, 2024

Do we want to add the X-Accel redirect to the author images to be consistent with the cover images?

I don't know if X-Accel is still useful due to these two PRs greatly reducing the response time for image fetch requests, so maybe we can just get rid of the X-Accel entirely.

@mikiher
Copy link
Contributor Author

mikiher commented Nov 3, 2024

Do we actually have users using X-accel?

I've never used this, but from what I read, this requires an Nginx web server running in front of Audiobookshelf to handle the X-accel-redirect responses. I haven't seen any example of how to do this in our codebase or documentation, so this would likely only be used by advanced users, on systems that need to deal with a high throughput.

For those who do use it, there might still be some (?) performance gain by offloading the actual serving of those files to Nginx, but I wouldn't keep support for it unless there's a substantial portion of our userbase using it.

@nichwall
Copy link
Contributor

nichwall commented Nov 3, 2024

It is implemented here for the cover cache.

if (global.XAccel) {
const encodedURI = encodeUriPath(global.XAccel + writtenFile)
Logger.debug(`Use X-Accel to serve static file ${encodedURI}`)
return res.status(204).header({ 'X-Accel-Redirect': encodedURI }).send()
}

@itzexor is the only one I know who uses it, I don't know if anyone else uses it. If these changes to the API makes the performance difference negligible I would say we can get rid of it.

@mikiher
Copy link
Contributor Author

mikiher commented Nov 3, 2024

My opinion is that X-accel support is an undocumented feature that only benefits very specific (undocumented) setups. It also provides a level of optimization that is not matched by our server's capabilities (I mean, we've just seen how the server has issues dealing with 30 requests in parallel before sending even a single byte back).

I would gladly remove it altogether.

@advplyr
Copy link
Owner

advplyr commented Nov 3, 2024

@itzexor is the only user I'm aware of that is using it

@advplyr
Copy link
Owner

advplyr commented Nov 3, 2024

Thanks!

@advplyr advplyr merged commit 978c2b0 into advplyr:master Nov 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants