I'm trying to fix performance issues in Apache.
Loading a webpage is fast until it's secured with database authorization. See this picture for comparison between static/dynamic pages and public/secured pages.
If I call the same query using PHP mysqli, the fetch is lightning fast... This tells me that the issue is not in the query itself or in the connection to the database, but in Apache or its DBD module/driver.
Host machine: Amazon EC2 instance Operating system: Amazon Linux 2023 Database: MariaDB - Local or using Amazon RDS, same issues The production server uses form authentication along with other configurations, but for testing purposes I'm using a machine with the default Apache configuration except for the following to replicate the issue in an easier context:
LoadModule dbd_module modules/mod_dbd.so LoadModule authn_dbd_module modules/mod_authn_dbd.so <IfModule dbd_module> DBDriver mysql DBDParams host=[localhost/127.0.0.1/AWS_RDS-DNS],port=[port],dbname=[dbname],user=[username],pass=[password] </IfModule> <Directory "/var/www/html/static_private"> AuthType Basic AuthBasicProvider dbd AuthName "Restricted area" AuthDBDUserPWQuery [any query results in same performance issue] Require valid-user </Directory> I installed the mysql driver for DBD using sudo dnf install apr-util-mysql
Refreshing many times private pages trigger a spike of 100% CPU load, while with public pages the CPU is stable around 0-1%.
Thank you!
A typical case in point is where an HTML page contains hundreds of objects (images, scripts, stylesheets, media, etc), and a request to the page generates hundreds of effectively-immediate requests for authenticated additional contents.. I'm trying to load a page with only 3 contents, before caching (to have even faster loading) I think I should fix the issue with query times. Caching partly hides the problem, the problem is not fixed. Am I correct?