Commit Graph

87 Commits

Author SHA1 Message Date
advplyr
6c1b4e3a36 Update db model references 2023-08-20 13:34:03 -05:00
advplyr
21343ffbd1 Update numIssues on filter data, fix watcher scanning in new items 2023-08-20 13:16:53 -05:00
advplyr
9d7d4c6902 Update filterData for authors/series when added/removed 2023-08-18 14:40:36 -05:00
advplyr
7222171c5b Update checking empty series to load from Db 2023-08-17 17:58:57 -05:00
advplyr
6d6e8613cf Update library API endpoints to load library items from db 2023-08-13 17:45:53 -05:00
advplyr
6056c14926 Update podcast controller to load library items from db 2023-08-12 17:29:08 -05:00
advplyr
345ff1aa66 Update author API endpoints to load library items from DB 2023-08-06 15:06:45 -05:00
advplyr
6814adffcc Update:Only load feeds when needed 2023-07-17 16:48:46 -05:00
advplyr
d0cd512be8 Fix:Crash when updating sequence on series #1919 2023-07-17 08:09:08 -05:00
advplyr
ddc54c8811 Update:Downloading library item shows log on the server with username #1461 2023-07-15 13:39:12 -05:00
advplyr
f4497acd48 Remove API routes for removing all items and purging media progress 2023-07-09 14:07:30 -05:00
advplyr
0ac63b2678 Update Series and Author model to be library specific 2023-07-08 09:57:32 -05:00
advplyr
cf7fd315b6 Init sqlite take 2 2023-07-04 18:14:44 -05:00
advplyr
d0bce2949e Add:FFProbe api endpoint 2023-06-25 16:16:11 -05:00
advplyr
014fc45c15 Add:Audiobooks only library settings, supplementary ebooks #1664 2023-06-10 12:46:57 -05:00
advplyr
019063e6f4 Update:New API routes for library files and downloads 2023-05-28 12:34:22 -05:00
advplyr
4f75a89633 Update:New EBook API endpoint 2023-05-28 10:47:28 -05:00
advplyr
b52e240025 Add:Batch re-scan #1754 2023-05-27 14:51:03 -05:00
advplyr
179f11f55d Add:Delete library items from file system #1439 2023-04-14 16:44:41 -05:00
advplyr
5a21e63d0b Add:Delete library files, condense item options in more menu #1439 2023-04-13 18:03:39 -05:00
advplyr
718890cfad Add:Download button to download full library item #580 2023-04-09 17:05:35 -05:00
advplyr
22b8622c67 Fix:Crash for invalid payload to update cover endpoint #1644 2023-04-09 15:01:14 -05:00
advplyr
5e5b674c17 Add:Remove all chapters button in chapter editor #1603 2023-04-09 12:47:36 -05:00
advplyr
022bf9d0ef Show current episode download on init and download queue page updates 2023-03-05 10:35:34 -06:00
advplyr
b957e1a36b Update:API endpoints for library and library item scan updated to POST requests 2023-02-03 17:50:42 -06:00
Lars Kiesow
08250e266e
Implement X-Accel Redirect
This patch implements [X-Accel](https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/)
redirect headers as an optional way for offloading static file delivery
from Express to Nginx, which is far better optimized for static file
delivery.

This provides a really easy to configure way for getting a huge
performance boost over delivering all files through Audiobookshelf.

How it works
------------

The way this works is basically that Audiobookshelf gets an HTTP request
for delivering a static file (let's say an audiobook). It will first
check the user is authorized and then convert the API path to a local
file path.

Now, instead of reading and delivering the file, Audiobookshelf will
return just the HTTP header with an additional `X-Accel-Redirect`
pointing to the file location on the file syste.

This header is picked up by Nginx which will then deliver the file.

Configuration
-------------

The configuration for this is very simple. You need to run Nginx as
reverse proxy and it must have access to your Audiobookshelf data
folder.

You then configure Audiobookshelf to use X-Accel by setting
`USE_X_ACCEL=/protected`. The path is the internal redirect path used by
Nginx.

In the Nginx configuration you then configure this location and map it
to the storage area to serve like this:

```
location /protected/ {
  internal;
  alias /;
}
```

That's all.

Impact
------

I just did a very simple performance test, downloading a 1170620819
bytes large audiobook file from another machine on the same network
like this, using `time -p` to measure how log the process took:

```sh
URL='https://url to audiobook…'

for i in `seq 1 50`
do
  echo "$i"
  curl -s -o /dev/null "${URL}"
done
```

This sequential test with 50 iterations and without x-accel resulted in:

```
real 413.42
user 197.11
sys 82.04
```

That is an average download speed of about 1080 MBit/s.

With X-Accel enabled, serving the files through Nginx, the same test
yielded the following results:

```
real 200.37
user 86.95
sys 29.79
```

That is an average download speed of about 2229 MBit/s, more than
doubling the previous speed.

I have also run the same test with 4 parallel processes and 25 downloads
each. Without x-accel, that test resulted in:

```
real 364.89
user 273.09
sys 112.75
```

That is an average speed of about 2448 MBit/s.

With X-Accel enabled, the parallel test also shows a significant
speedup:

```
real 167.19
user 195.62
sys 78.61
```

That is an average speed of about 5342 MBit/s.

While doing that, I also peaked at the system load which was a bit lower
when using X-Accel. Even though the system was delivering far more data.
But I just looked at the `load1` values and did not build a proper test
for that. That means, I cant provide any definitive data.

Supported Media
---------------

The current implementation works for audio files and book covers. There
are other media files which would benefit from this mechanism like feed
covers or author pictures.

But that's something for a future developer ;-)
2023-01-23 00:02:27 +01:00
advplyr
70ba2f7850 Add:RSS feed for series & cleanup empty series from db #1265 2022-12-31 16:58:19 -06:00
advplyr
315c83e4c3 RSS feed for collection to update when any item in the collection is updated #606 2022-12-28 18:08:03 -06:00
advplyr
308ccf470f Add:Open RSS feed for collection #606 #1265 2022-12-27 18:03:31 -06:00
advplyr
e803dcd325 Update:RSS feed API routes 2022-12-26 16:58:36 -06:00
advplyr
0ae853c119 Update library items batch get route 2022-12-12 17:36:53 -06:00
advplyr
5c31687a0f Merge branch 'master' into server/respond-with-objects 2022-12-12 17:20:14 -06:00
advplyr
67db41a525 Update:Get item cover API endpoint to allow for returning the raw cover image 2022-12-04 16:23:15 -06:00
Paul Nettleton
b84882d9d1 Update LibraryItemController.js to respond with objects
Changes:
- `batchGet` (POST /api/items/batch/get)
2022-11-29 11:37:45 -06:00
advplyr
e2af33e136 Update:Refactor socket connection management into SocketAuthority 2022-11-24 15:53:58 -06:00
advplyr
e3ba739db5 Update:Encode & embed metadata API endpoints, separate cache & search endpoints into controllers 2022-11-19 13:28:06 -06:00
advplyr
7485cf1a26 Add:Batch select audiobook play button, item page mobile screen size cleanup 2022-11-19 10:20:10 -06:00
advplyr
7d569e1e3e Update:Some incorrect status codes returned from API 2022-11-12 09:36:00 -06:00
advplyr
1118b8b782 Metadata embed and m4b merge fixes and cleanup 2022-11-05 13:13:52 -05:00
advplyr
c254dc5144 Add:Button for testing scan probes in audiobook tracks table 2022-10-02 15:24:32 -05:00
advplyr
97da73baf3 Update:Experimental metadata embed tool to use tone 2022-09-25 15:56:06 -05:00
Undergrid
014ad668a5
Update server/controllers/LibraryItemController.js
Co-authored-by: advplyr <67830747+advplyr@users.noreply.github.com>
2022-09-24 23:38:44 +01:00
Undergrid
62c59c634c
Update server/controllers/LibraryItemController.js
Co-authored-by: advplyr <67830747+advplyr@users.noreply.github.com>
2022-09-24 23:38:18 +01:00
Nick Thomson
dd8577354b Fixing tabs again. 2022-09-24 22:20:49 +01:00
Nick Thomson
3e7a76574b Switch to using the websocket for confirmation of batch updates, allowing the main request to be done asynchronously 2022-09-24 22:17:36 +01:00
Nick Thomson
2d6f9bab8b Added totals of updated and unmatched books to toast shown at completion of batch quick match. 2022-09-24 18:57:09 +01:00
Nick Thomson
731cf8e4ed Fix whitespace issues 2022-09-23 19:37:30 +01:00
Nick Thomson
dbb62069ef Implementation of batch quick match API and related options dialog 2022-09-23 17:51:34 +01:00
advplyr
33ae93e61e Fix:Add new podcast crash #920 2022-08-20 19:32:37 -05:00
advplyr
46668854ad Add:Schedule podcast new episode checks 2022-08-19 18:41:58 -05:00