Re: Speed up web pages : MySQL or PHP solutions ?
- From: Michael Fesser <netizen@xxxxxx>
- Date: Tue, 19 Feb 2008 20:21:22 +0100
..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
.
- Follow-Ups:
- Re: Speed up web pages : MySQL or PHP solutions ?
- From: The Natural Philosopher
- Re: Speed up web pages : MySQL or PHP solutions ?
- References:
- Speed up web pages : MySQL or PHP solutions ?
- From: Pseudonyme
- Speed up web pages : MySQL or PHP solutions ?
- Prev by Date: Re: Simple CMS
- Next by Date: Re: How do I pass an array key from a multi-dimensional array to a new array?
- Previous by thread: Re: Speed up web pages : MySQL or PHP solutions ?
- Next by thread: Re: Speed up web pages : MySQL or PHP solutions ?
- Index(es):
Relevant Pages
|