Skip to content

Technical Support Request: WordPress Instance (13.235.224.140) Experiencing Persistent Latency and Database Connection Errors

-2

Enter image description here Dear AWS Support Team,

I am writing to report a critical performance issue with my WordPress Lightsail instance (Static IP: 13.235.224.140). My domain, karmartech.com, is currently experiencing extreme latency, often timing out after 40 minutes, and now consistently displaying a critical error: "Error establishing a database connection."

I have attached a screenshot of this error for your reference, titled "Wordpress server loading issue.JPG".

Current Configuration Details:

Domain Registrar: Spaceship (Custom Nameservers pointed to AWS).

DNS Management: AWS Lightsail DNS Zone (A Record pointing to 13.235.224.140; CNAME pointing www to root).

Issue: The site is failing to connect to the database server at localhost, as shown in the attached file "Wordpress server loading issue.JPG".

Troubleshooting Performed:

Verified DNS propagation and record accuracy via Lightsail DNS Zone.

Attempted multiple theme changes and configuration resets via the SSH Terminal.

Performed repeated instance reboots; however, the service remains highly unstable and the database connection error persists.

Given that these issues persist despite standard configuration checks, I suspect there may be a resource bottleneck, a corrupted database service, or a misconfiguration preventing the MySQL/MariaDB service from initializing.

Could you please assist by:

Checking the instance's health logs for any service-level crashes or database service failures.

Verifying if the database service is running correctly on this instance.

Advising on whether I should perform a full instance snapshot and redeploy, or if there is a specific log file I should inspect to identify the root cause of this database failure.

I have exhausted my standard troubleshooting steps and would appreciate your technical expertise in stabilizing this environment.

Best Regards,

Usman Khan AWS Account ID:732231074744

asked a month ago58 views

3 Answers
0

Thank you for reaching out regarding the performance and database connectivity issues with your WordPress Lightsail instance. I understand how critical this is for your site's availability.

Based on the "Error establishing a database connection" message you're seeing, this typically indicates that WordPress cannot communicate with the MySQL/MariaDB database service. Here are some steps to help diagnose and resolve this issue:

Immediate Diagnostic Steps via SSH:

  1. Check if the database service is running:
  • Connect via SSH and run: sudo systemctl status mariadb or sudo systemctl status mysql
  • If the service is stopped, start it with: sudo systemctl start mariadb or sudo systemctl start mysql
  1. Review database error logs:
  • Check MariaDB/MySQL logs at: /var/log/mysql/error.log or /var/log/mariadb/mariadb.log
  • These logs will reveal if the database is crashing due to resource constraints or corruption
  1. Verify database credentials:
  • Ensure your wp-config.php file has the correct database name, username, and password
  • The file is typically located at /opt/bitnami/wordpress/wp-config.php or similar path depending on your stack
  1. Check available disk space:
  • Run: df -h to verify you haven't run out of disk space, which can prevent the database from starting

Resource Considerations:

The extreme latency and timeouts you're experiencing suggest your instance may be undersized for your workload. Consider:

  • Reviewing your instance's CPU and memory utilization in the Lightsail metrics
  • Upgrading to a larger instance plan if resources are consistently maxed out
  • Optimizing your WordPress installation (plugins, caching, database optimization)

Next Steps:

If the database service won't start or logs indicate corruption, you may need to:

  • Create a snapshot of your current instance before making changes
  • Attempt database repair using MySQL repair tools
  • Consider restoring from a previous snapshot if you have one from when the site was working

For detailed technical assistance with your specific instance configuration and logs, please add this information as correspondence in the AWS Support Center at https://console.aws.amazon.com/support/, where the support team can review your instance-specific details and provide targeted guidance based on your AWS Support plan.

answered a month ago

AWS
SUPPORT ENGINEER

reviewed a month ago

  • Technical Support Request: WordPress Instance (13.235.224.140) - Database Service Running but Connection Error Persists Dear AWS Support Team,

    Following up on my previous request regarding the "Error establishing a database connection" on my instance (13.235.224.140), I have performed further diagnostic checks via the SSH terminal.

    New Findings: I ran sudo systemctl status mariadb and confirmed that the database service is active (running) and currently "Taking your SQL requests now." Despite this, the WordPress application remains unable to connect to the database.

    Diagnostics:

    Database Status: Verified active (running). Logs: The MariaDB service shows no recent crash logs. Current Issue: The application consistently throws an "Error establishing a database connection" message (see previously attached screenshot: "Wordpress server loading issue.JPG"). Since the database engine is confirmed to be healthy, the issue likely resides in the wp-config.php credentials or a socket mismatch between the application and the database service. Could you please assist by: Verifying if the database user permissions or the localhost socket path in my wp-config.php file are correctly aligned with the current MariaDB configuration? Advising if there is a conflict in the database host setting (i.e., should it be 127.0.0.1 instead of localhost?). Directing me to the specific logs that capture the application's attempt to reach the database (e.g., PHP-FPM or Apache error logs).

0

Hello,

Can you confirm if you are using the smallest bundle size for your wordpress instance and also the disk is full? if so, The likely root cause is becuase A nano instance is undersized for WordPress + MariaDB running together. Over time, as the site accumulates content, plugins, and traffic, MariaDB gets OOM-killed. It's recommend to upgrade to larger instance.

  • command to check your disk usage.
df -h
AWS
MODERATOR

answered a month ago

EXPERT

reviewed a month ago

0

Hi Usman,

The symptoms you're describing — "Error establishing a database connection," extreme latency, and instability after reboots — are consistent with your instance running out of memory. When this happens, the Linux kernel terminates the MariaDB database process to free memory (called an "OOM kill"), which causes the database connection error you're seeing. Rebooting temporarily restarts MariaDB, but it gets killed again once memory is exhausted.

Step 1: Confirm the issue

Connect to your instance via SSH and run:

sudo dmesg | grep -i "out of memory"

If you see entries like Out of memory: Killed process ... (mariadbd), this confirms memory pressure is the root cause.

You can also check how much memory is currently available:

free -m

Look at the available column — if it's below about 50 MB, your instance is critically low on memory.

Step 2: Restart MariaDB (immediate fix)

If your site is currently down:

sudo systemctl restart mariadb
sudo systemctl status mariadb

If the status shows Active: active (running), your site should come back up — but this is temporary if memory pressure is the underlying cause.

Step 3: Add swap space (prevents future OOM kills)

Check if swap is already enabled:

cat /proc/swaps

If no swap is configured, create one:

sudo dd if=/dev/zero of=/mnt/.lightsail.swap bs=1K count=665600 status=progress
sudo chmod 600 /mnt/.lightsail.swap
sudo mkswap /mnt/.lightsail.swap
sudo swapon /mnt/.lightsail.swap
echo '/mnt/.lightsail.swap none swap sw 0 0' | sudo tee -a /etc/fstab

Step 4: Tune MariaDB memory usage

The default innodb_buffer_pool_size may be too large for your instance. Check your instance's total memory with free -m, then create this configuration file:

sudo tee /etc/mysql/mariadb.conf.d/90-lightsail-memory.cnf > /dev/null <<'EOF'
[mysqld]
innodb_buffer_pool_size = 16M
EOF
sudo systemctl restart mariadb

(Use 16M for instances up to ~1.5 GB RAM, 256M for 2–4 GB RAM.)

Step 5: Tune Apache worker processes

sudo tee /etc/apache2/mods-available/mpm_prefork.conf > /dev/null <<'EOF'
<IfModule mpm_prefork_module>
    StartServers            1
    MinSpareServers         1
    MaxSpareServers         3
    MaxRequestWorkers       5
    MaxConnectionsPerChild  5000
</IfModule>
EOF
sudo systemctl restart apache2

(Use MaxRequestWorkers 5 for instances up to ~1.5 GB, 10 for 2–4 GB.)

Best regards

AWS

answered a month ago

EXPERT

reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.