Re: Speed up web pages : MySQL or PHP solutions ?



..oO(Pseudonyme)

We are receiving many connections.
People come to us to view 1 image or text + 1 PHP content. Some other
people come to destroy.

Tasks to our servers :

1. Do we have to give the image ? = MYSQL Querry
2. Give the Image = Brandwidth
3. Give the text-content = PHP
4. Can you click on the image = MYSQL

Our web pages are displaid too slowly, like if we had an enormous
traffic.

We try to analyze and modify DB Querries and Web codes.

Analyzing modifications, it appears that in a web page, inserting :

MYSQL (SELECT two fieds in T1 crossed with two fields in T2) is not
consuming a lot of CPU for the MYSQL process BUT is consuming a lot of
CPU for the HTTPD process. Maybe bc of the time to get results.


What are the leveraged actions to embeed the speed of the web pages ?

1. Minimize requests to MYSQL
2. Minimize PHP readen content (e.g.
while(isset($_COOKIE['$j'."$i"]) ....)

Many thanks for any advices from your knowledge and experience.

Just some general ideas, not all may apply in your case:

* Use a profiler like XDebug to find bottlenecks in the code.
* Check the DB to make sure your tables are properly indexed (you can
use EXPLAIN SELECT ... to get a query analysis).
* Don't use SELECT *, only fetch the data you really need.
* Use prepared statements and re-use them if possible.
* Make your content cacheable by sending appropriate HTTP headers.
* Cache content on the server to avoid re-creation over and over again,
for example if you should create images on-the-fly.
* Reduce the number of HTTP requests and roundtrips to the server.
* Use HTTP compression for your text content (HTML, CSS, JS).
* ...

Micha
.



Relevant Pages

  • Executing PHP files on remote web server
    ... We have a web app which uses PHP and MySQL on our in-house Apache web ... database to the web host because a lot of the data is sensitive. ... By loading the non-sensitive data into the web host's MySQL tables, ... running on our own web server. ...
    (comp.lang.php)
  • Re: Newbie Security Questions
    ... questions about PHP and its usage with MySQL. ... And even if they do, its a strange Mysql server that is sitting on the internet accepting requests from all and sundry..normally you run them on a local network, or the same box and set mysql to only accept requests FROM the apache server.. ... You have to layer that over the top using cookies and user logins if you want it. ...
    (comp.lang.php)
  • Re: Server load too high
    ... > the new dedicated server with Dual Xeon 3.2 GHz and 2GB Ram. ... > The board is written in PHP with Mysql. ... Well, since it looks like MySQL is eating more of the CPU, it could be ... In any case, I've been using PHP5 for a while now, and I've not ...
    (comp.lang.php)
  • Re: phpMyAdmin install help
    ... this means that PHP is lacking a certain functionality. ... talking to MySQL servers. ... It doesn't really matter where the MySQL server is running. ...
    (php.general)
  • Re: Speed up web pages : MySQL or PHP solutions ?
    ... People come to us to view 1 image or text + 1 PHP content. ... Can you click on the image = MYSQL ... Make your content cacheable by sending appropriate HTTP headers. ... Cache content on the server to avoid re-creation over and over again, ...
    (comp.lang.php)