Loading multiple PHP files simultaneously to speed up page load time

470 views Asked by At

I have developed a HTML5, PHP/MySQL website that uses 1 local and 1 remote MySQL database. When a user logs into the site he is presented with a 'Homepage' that displays (Depending on the user) between 1 and 10 jQuery tabs.

Each tab executes a PHP include command to include a self contained block of code that opens a DB handle to the remote DB, fetches a SQL result, processes and closes it, opens a handle to the local DB, fetches a SQL result, processes that and closes it, then outputs a HTML table. This table is then displayed in the tab.

The problem is that with multiple tabs on show, (4+), the page loading time is getting a bit slow, sometimes up to 10 seconds. The site is on a hosted server which I assume has a fast connection to the remote DB, (Unlike my XAMPP development setup).

Is there a way of speeding up the page load time?

I was thinking along the lines of making the content of each tab an iframe, which would open the associated block of 'table making' code for that tab. Of course this would mean that for a Homepage with 5 tabs the browser would effectively be opening 6 pages, (The Homepage and 5 tabs which are independent pages in themselves).

Or is there a smarter way of achieving a faster page load?

1

There are 1 answers

1
Marek On

Do you use sessions? It might be the session locking. Call session_write_close() as soon as possible.