PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, March 10, 2022

[FIXED] MAMP running extremely slow with external database connection

 March 10, 2022     codeigniter, mamp, mysql, php     No comments   

Issue

I am dealing with really slow loading of pages. I used Chrome console's Network tab to get this information (but it is slow on all browsers).

I have researched the issue heavily, but now I am completely stumped. I have tried Blowski's answer to MAMP: reloading pages is very slow (editing my hosts file), but had no luck with getting the page to load faster.

I am running OS X 10.8.5, CodeIgniter 2.1.3, and connecting to a remote MySQL database (which is on the same server as the live web server). Not sure if that has anything to do with the waiting being so long. Speed tests for loading the same page are below:

localhost
Waiting time is 13.49 seconds

enter image description here

Web Server
Waiting time is 222 milliseconds

enter image description here

What can I do to fix this issue?

Update: I've narrowed down the issue to the MySQL database (which is located on a remote server, separate from where PHP (MAMP) is installed). Are there any settings I would need to change to fix this horrible load time? I am also connecting to the database using an IP address and not a domain name, so I don't believe it is a DNS issue with the server MySQL is installed on.


Solution

For a general solution, try using a profiler - it is meant for diagnosing performance issues.

this link has a pretty good tutorial - http://geek.michaelgrace.org/2011/08/xdebug-cachegrind-and-mamp-on-mac-osx/

You should examine the results to see which function(s) take the most time of execution. I suspect your remote database connection may be at fault, but a profiler will give you definitive results.



Answered By - xiankai
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing