-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Performance Issue: Slow Page Load Times (500-700ms) on ARM64 Devices #5385
Comments
Handily, I just had reflashed my Pi4 in the last few days so have one to hand for debugging. Raspi Hardware/OS info
Test A - Vanilla installSetup a manual install using system packages, with nginx, default-mysql-server and PHP8.2. Benchmark
Re-running, the above is on the high-end for me, I'm seeing a range of max from 100-200 generally. Running some (undocumented/unadvised) app cache commands ( Test B - Docker composeInstalled docker using system packages ( compose fileservices:
us-bookstack02-app:
image: linuxserver/bookstack:v24.12-ls184
container_name: us-bookstack02-app
hostname: us-bookstack02-app
networks:
- us-bookstack02
ports:
- "8080:80"
volumes:
- ./app:/config
environment:
PUID: 1000
PGID: 1000
APP_URL: "http://192.168.1.20:8080"
APP_KEY: "base64:JBlR67RL9gx/z7QjMLHFgcwMLn2+q4udjHhyiBxpJv4="
DB_HOST: "us-bookstack02-db"
DB_DATABASE: bookstack02
DB_USERNAME: dbadmin
DB_PASSWORD: "secret"
restart: unless-stopped
security_opt:
- no-new-privileges:true
depends_on:
- us-bookstack02-db
us-bookstack02-db:
image: linuxserver/mariadb:10.11.10
container_name: us-bookstack02-db
hostname: us-bookstack02-db
networks:
- us-bookstack02
expose:
- 3306
volumes:
- ./db:/config
environment:
PUID: 1000
PGID: 1000
MYSQL_ROOT_PASSWORD: "secret"
MYSQL_DATABASE: bookstack02
MYSQL_USER: dbadmin
MYSQL_PASSWORD: "secret"
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
us-bookstack02:
name: us-bookstack02
driver: bridge Benchmark
So this is about 5x as slow, and feels it in app too. Test C - Docker compose with opcache addedIn test B, I noticed opcache was disabled for the running PHP, so I enabled it by accessing the container This seemed to help: Benchmark
Brings it down to numbers similar to Test A results. Rough Evaluation/ThoughtsWithout spending time debugging into this (getting a bit late here) my guess is that this isn't ARM specific, but the app is slow without the opcache optimizations due to using quite slow storage (assuming you're using an SD card too) while an app like BookStack relies on loading many different app/framework/library files in a short period. Again, didn't specifically test this theory but when debugging the compose setup I checked app-level timings and saw the actual app & database logic was minimal, but there was large proceeding app times, pointing roughly to app loading/boot. Try hacking in the opcache extension on your instance like I did above and see if that dramatically improves things for you too. |
Hi @ssddanbrown, Thanks for your quick insights and recommendation. For the Raspberry Pi 4, I am not using an SD card but an SSD drive connected via the USB 3.0 interface with a USB-to-SATA adapter. The performance is definitely better than an SD card, although it is limited by what the USB port can offer. The VM used for testing is deployed on an NVMe drive. Based on your recommendation, I built a new image using the Dockerfile provided by LinuxServer.io, with a modification to include php83-opcache. Below are the test results comparing the original LinuxServer image and the custom image I built with opcache. Without Opcache
With Opcache
Without Opcache - VM
With Opcache - VM
I have also updated my primary Bookstack instance and observed a drastic performance gain while navigating between pages. Do you intend to perform any other tests to confirm this theory on your end? Let me know if you would like me to test anything else. |
Ah, okay, might still just be the underlying impact of loading many files in a non-opcache environment on this kinda hardware. Also wouldn't be surpised if non-opcache php is less optimized on ARM, since ARM is less common and has gained its popularity while opcache is an option.
Probably not, we know what helps here, and opcache is a pretty common default in most production setups these days. |
Thank you for your help, @ssddanbrown. I have reported your feedback to the LinuxServer team. Hopefully, they will consider including this extension by default, so users won’t need to build the images locally with every update or install it using a custom script. |
@codenamek83 Yeah, I saw they already have a PR on the go (linuxserver/docker-bookstack#254). Thanks for the detail you provided and the time you spent on this with a view to help. |
Describe the Bug
I have deployed BookStack as a Docker container on a Raspberry Pi 4 with 8 GB of RAM, using the Docker image built by LinuxServer for both BookStack and MariaDB. The server is hosted locally behind a reverse proxy. I have consistently observed slow page load times ranging from 500 to 700 ms. This issue seems to be specific to the architecture, as other platforms perform significantly better.
The load time is slow when loading the page.
The load time is normal when loading the kb-icon.png.
To isolate the problem, I created a test environment without a reverse proxy server. The Raspberry Pi and VM used for testing are hosted locally on my LAN. All tests were performed using http://ip:port.
I deployed a new BookStack stack (LinuxServer images) on an AMD64 VM with 2 GB of RAM and 1 vCPU using a Docker Compose file. The page load time was normal, and no slowness was observed.
I deployed a new BookStack stack (LinuxServer images) on an AMD64 VM with 2 GB of RAM and 1 vCPU using a Docker Compose file. I copied the data and database from my primary node to test with the actual data. The page load time was normal, and no slowness was observed.
I deployed a new BookStack stack (Solidnerd image for Bookstack) on an AMD64 VM with 2 GB of RAM and 1 vCPU using a Docker Compose file. The page load time was normal, and no slowness was observed.
I deployed a new BookStack stack (LinuxServer images) on a Raspberry Pi 4 with 8 GB of RAM, using a Docker Compose file. The page load time was between 500-800ms.
SolidNerd only provides a prebuilt image for AMD64, so I had to build a Docker image for ARM64 using the Dockerfile provided by them. I deployed a new BookStack stack (image built with SolidNerd's Dockerfile) on a Raspberry Pi 4 with 8 GB of RAM, using a Docker Compose file. The page load time was between 500–800 ms.
Based on the listed test cases, I believe the issue is somehow limited to running BookStack on ARM64 devices. Therefore, I tried the following steps to determine whether the issue lies with the Docker image or the BookStack application:
I appended
/config/nginx/site-confs/default.conf
to allow loading the test.php file.Test accessing the test page from browser. The page load time was normal, and no slowness was observed.
I am reporting the issue here because I feel it is very specific to the BookStack app and not the Docker environment in which it is contained. Most of the time, the Docker image maintainer can't be helpful with these types of issues. I have tried my best to gather the details and summarize them for your reference. I have also performed many other troubleshooting procedures, including database optimization and PHP optimization, but I felt they were no longer relevant to the issue.
Steps to Reproduce
I have explained the steps in the description.
Expected Behaviour
The page loads much quicker since the server is on the LAN.
Screenshots or Additional Context
The Docker Compose file used to deploy the containers:
Browser Details
No response
Exact BookStack Version
v24.12
The text was updated successfully, but these errors were encountered: