10+ second response times on new install (confirmed not nginx or database) #876

Closed
opened 2026-02-04 22:39:41 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @anstosa on GitHub (Oct 20, 2018).

Describe the bug
I'm getting 10 second response times on all requests on a brand new install. I've instrumeted my firewall, the nginx in the bookstack container, and the mariadb instance and they cumulatively add 200ms to the response times. Almost all of the 10 seconds is upstream of nginx (only the bookstack app itself)

Steps To Reproduce
Steps to reproduce the behavior:

  1. Go to any page

Expected behavior
Responds in less than a second

Your Configuration (please complete the following information):

  • Exact BookStack Version (Found in settings): v0.24.1
  • PHP Version: 7
  • Hosting Method (Nginx/Apache/Docker): I'm using the linxserver bookstack and mariadb containers inside a kubernetes cluster.
Originally created by @anstosa on GitHub (Oct 20, 2018). **Describe the bug** I'm getting 10 second response times on all requests on a brand new install. I've instrumeted my firewall, the nginx in the bookstack container, and the mariadb instance and they cumulatively add 200ms to the response times. Almost all of the 10 seconds is upstream of nginx (only the bookstack app itself) **Steps To Reproduce** Steps to reproduce the behavior: 1. Go to any page **Expected behavior** Responds in less than a second **Your Configuration (please complete the following information):** - Exact BookStack Version (Found in settings): v0.24.1 - PHP Version: 7 - Hosting Method (Nginx/Apache/Docker): I'm using the linxserver [bookstack](https://github.com/linuxserver/docker-bookstack) and [mariadb](https://github.com/linuxserver/docker-mariadb) containers inside a kubernetes cluster.
OVERLORD added the 🐕 Support label 2026-02-04 22:39:41 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Oct 20, 2018):

Hi @anstosa,
I've just tested a setup using those two docker containers. All seemed to work okay with sub 200ms response times (From app to browser) on my dev machine.

I think this is going to be very specific to your setup. I'm not familiar with k8s but my best guesses are that this may be down to:

  1. Limited host machine resources. or:
  2. Network delay between the mariadb and bookstack. If there is a significant network delay between these two ( > ~5ms) then this delay will be multiplied be a large amount as BookStack can make quite a few database calls.
@ssddanbrown commented on GitHub (Oct 20, 2018): Hi @anstosa, I've just tested a setup using those two docker containers. All seemed to work okay with sub 200ms response times (From app to browser) on my dev machine. I think this is going to be very specific to your setup. I'm not familiar with k8s but my best guesses are that this may be down to: 1. Limited host machine resources. or: 2. Network delay between the mariadb and bookstack. If there is a significant network delay between these two ( > ~5ms) then this delay will be multiplied be a large amount as BookStack can make quite a few database calls.
Author
Owner

@anstosa commented on GitHub (Oct 20, 2018):

Bummer, I will keep digging. Thank you for trying to repro.

If I log into the bookstack container and traceroute the mariadb port it's 1 hop instantaneous.

root@bookstack-d7b87c4bd-bh6f9:/$ traceroute <host> -p 3306
traceroute to <host> (<ip>), 30 hops max, 46 byte packets
 1  <ip> (<ip>)  0.005 ms  0.009 ms  0.005 ms
 2  *  *  *
 3  *  *  *

I will turn all the debugging on in bookstack and see if I can get any hints about what the slowdown is.

@anstosa commented on GitHub (Oct 20, 2018): Bummer, I will keep digging. Thank you for trying to repro. If I log into the bookstack container and traceroute the mariadb port it's 1 hop instantaneous. ``` root@bookstack-d7b87c4bd-bh6f9:/$ traceroute <host> -p 3306 traceroute to <host> (<ip>), 30 hops max, 46 byte packets 1 <ip> (<ip>) 0.005 ms 0.009 ms 0.005 ms 2 * * * 3 * * * ``` I will turn all the debugging on in bookstack and see if I can get any hints about what the slowdown is.
Author
Owner

@anstosa commented on GitHub (Oct 20, 2018):

Any idea why I wouldn't be getting a laravel.log in my storage directory? The app is up and running, just slow. And I don't see how it could be a permissions issue because it has no problem writing any of the other files it's responsible for

@anstosa commented on GitHub (Oct 20, 2018): Any idea why I wouldn't be getting a `laravel.log` in my storage directory? The app is up and running, just slow. And I don't see how it could be a permissions issue because it has no problem writing any of the other files it's responsible for
Author
Owner

@anstosa commented on GitHub (Oct 20, 2018):

Okay after turning debugging on, the app thinks a query took 10.13s and the database thinks it took a 0.000054s so the only answer is that something is slow routing the request to the database right?
image

@anstosa commented on GitHub (Oct 20, 2018): Okay after turning debugging on, the app thinks a query took 10.13s and the database thinks it took a 0.000054s so the only answer is that something is slow routing the request to the database right? ![image](https://user-images.githubusercontent.com/568242/47260116-d54c4480-d469-11e8-96d7-d6e98757b4fa.png)
Author
Owner

@ssddanbrown commented on GitHub (Oct 20, 2018):

@anstosa Looking at https://github.com/linuxserver/docker-bookstack/blob/master/root/etc/cont-init.d/50-config it looks like the logs directory is not symlinked to the /config path like everything else. That's why you're not getting logs.

Yeah, those timings are strange. Would be interesting to run a direct mysql query from the bookstack container on cmd line.

@ssddanbrown commented on GitHub (Oct 20, 2018): @anstosa Looking at https://github.com/linuxserver/docker-bookstack/blob/master/root/etc/cont-init.d/50-config it looks like the logs directory is not symlinked to the `/config` path like everything else. That's why you're not getting logs. Yeah, those timings are strange. Would be interesting to run a direct mysql query from the bookstack container on cmd line.
Author
Owner

@anstosa commented on GitHub (Oct 21, 2018):

If I go into the container, /var/www/html/storage/logs is empty. Or would it have to be symlinked at the beginning to have anything in it?

Tried running that exact same query from the cmd line:

root@bookstack-d7b87c4bd-xms9m:/root$ mysql -h <host> -u bookstack -p<password>
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15550
Server version: 10.3.10-MariaDB-1:10.3.10+maria~bionic-log mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use bookstackapp
Database changed
MariaaDB [bookstackapp]> select * from `users` where `system_name` = 'public' limit 1;
+----+-------+-------------------+----------+----------------+---------------------+---------------------+-----------------+----------+------------------+-------------+
| id | name  | email             | password | remember_token | created_at          | updated_at          | email_confirmed | image_id | external_auth_id | system_name |
+----+-------+-------------------+----------+----------------+---------------------+---------------------+-----------------+----------+------------------+-------------+
|  2 | Guest | guest@example.com |          | NULL           | 2018-10-19 17:43:09 | 2018-10-19 17:43:09 |               1 |        0 |                  | public      |
+----+-------+-------------------+----------+----------------+---------------------+---------------------+-----------------+----------+------------------+-------------+
1 row in set (0.00 sec)

So it looks like the queries are fast and the connection is fast BUT it took 10 seconds to get the MariaDB shell from when I hit enter on the login command. Similarly, above there were 2 DB queries on the login page but only the first took 10 seconds. It must be the DB auth that's slow then? Does bookstack create a new database connection for each client request?

@anstosa commented on GitHub (Oct 21, 2018): If I go into the container, `/var/www/html/storage/logs` is empty. Or would it have to be symlinked at the beginning to have anything in it? Tried running that exact same query from the cmd line: ``` root@bookstack-d7b87c4bd-xms9m:/root$ mysql -h <host> -u bookstack -p<password> Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 15550 Server version: 10.3.10-MariaDB-1:10.3.10+maria~bionic-log mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use bookstackapp Database changed MariaaDB [bookstackapp]> select * from `users` where `system_name` = 'public' limit 1; +----+-------+-------------------+----------+----------------+---------------------+---------------------+-----------------+----------+------------------+-------------+ | id | name | email | password | remember_token | created_at | updated_at | email_confirmed | image_id | external_auth_id | system_name | +----+-------+-------------------+----------+----------------+---------------------+---------------------+-----------------+----------+------------------+-------------+ | 2 | Guest | guest@example.com | | NULL | 2018-10-19 17:43:09 | 2018-10-19 17:43:09 | 1 | 0 | | public | +----+-------+-------------------+----------+----------------+---------------------+---------------------+-----------------+----------+------------------+-------------+ 1 row in set (0.00 sec) ``` So it looks like the queries are fast and the connection is fast **_BUT_** it took 10 seconds to get the MariaDB shell from when I hit enter on the login command. Similarly, above there were 2 DB queries on the login page but only the first took 10 seconds. It must be the DB auth that's slow then? Does bookstack create a new database connection for each client request?
Author
Owner

@anstosa commented on GitHub (Oct 21, 2018):

Okay, nmap is similarly delayed. There's definitely an issue on my network not related to bookstack or mariiadb. Just taking forever to establish connections for some reason.

@anstosa commented on GitHub (Oct 21, 2018): Okay, `nmap` is similarly delayed. There's definitely an issue on my network not related to bookstack or mariiadb. Just taking forever to establish connections for some reason.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#876