Database stop reading while holding web rendering

I have a PHP web service that I am creating.

I can see the problem looming and would like to contribute to the fight against it before writing too much code.

I have 14 sites, each of which contains an instance of the mysql database, which is updated by another custom perl script.

In order to consolidate this data in a single web interface, I am trying to write a php web page that does the following.

On the first page, the web server connects to all 14 database servers and discards the required information, and then displays it on the page. Currently, this works flawlessly, since all the data is stored on my local machine, but in production this data will be distributed across 14 separate databases.

So my question is: what is the best way to abstract from a database read from a user interface drawing. Ideally, I would like to have a full visualization of the web page, with a loading bar indicating when the user can expect the data to be displayed.

Is this something achievable through AJAX, or should I look in the other direction.

Thanks in advance.

+5
source share
3 answers

I would do something like this:

  • create a small php proxy that can be called from AJAX as you cannot connect to another site using AJAX
  • display full page layout with blank elements
  • start displaying elements as soon as the DOM is ready using AJAX
  • each item will have a loading bar as soon as you start loading data from functions

:

 ___________________________________
| data_1 | data_2 | data_3 | data_4 |
 ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

loadData1() data1_id AJAX

 ___________________________________
| ...... | data_2 | data_3 | data_4 |
 ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

+1

Ajax - - , Ajax- , . , ajax- .

0

Why don't you cache the content locally (so the user doesn't have to wait) and then retrieve the content in real time via ajax?

0
source

All Articles