Localhost 'queuing' requests

Discussion in 'Web Design and Development' started by freshnet, Jan 6, 2016.

  1. freshnet macrumors newbie

    Joined:
    May 15, 2011
    Location:
    Calgary, Canada
    #1
    I recently set up several different web projects that I'm working on locally using PHP 5.6 and MYSQL 5.6. One of the sites uses an API. I thought that this site was running slowly, then I realized that any other localhost pages would finish what they were doing first (i.e. if I load 3 pages on localhost, page 3 doesn't start actually running until pages 1 and 2 are finished. All the sites are in different folders, using different databases (if any), but this happens even if I try to load 2 pages in the same site. Is there any way around this? I think I could set up multiple localhosts, but actually the main problem is multiple requests with the same site being queued. This is definitely a problem outside the code: I checked MYSQL and the connection to the database isn't even made for the 2nd page until the 1st page finishes.

    I hope I explained that ok!
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    I honestly don't know what webserver OS X ships with anymore, but this is your bottleneck. There is a max connection or worker count that is limiting simultaneous page loads. This is generally to reduce resource usage, especially on a normal desktop setup. You should be able to reconfigure this, but I'm not sure how these days based on what server is running. A Google for "increase connections web server OS X 10.X" where X is your OS version ought to lay it out.
     
  3. freshnet thread starter macrumors newbie

    Joined:
    May 15, 2011
    Location:
    Calgary, Canada
    #3
    Thanks for pointing me in the right direction! After a lot of reading about this, e.g. http://stackoverflow.com/questions/1430883/simultaneous-requests-to-php-script, I found that the bottleneck is in fact PHP. I was able to show this by writing a quick PHP script on localhost that waits for 5 seconds, then loading an html file on localhost while it was running. The html file loaded instantly, which showed this was PHP.

    There are a couple of workarounds, what I am doing is using vcap.me (which resolves to localhost) and hitting a different url with each page, e.g. 1.vcap.me/test.php, 2.vcap.me/test.php.

    thanks!
     

Share This Page