473,415 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,415 software developers and data experts.

Caching query results: PHP caching vs MySQL caching

My site is a bit slow showing the main page so I thought caching query
result in PHP will improve performace.
Then I read MySQL documentation and saw that MySQL does have a caching
feature.
So... now I dont know if doing the PHP caching is worth the pain.
Would there be any noticed performace improvement if I cache query
results in PHP, considering that MySQL is already caching the queries?

Thanks

Dec 12 '06 #1
4 2954
On 12 Dec 2006 09:35:00 -0800, "Hermann" <He*************@gmail.comwrote:
>My site is a bit slow showing the main page so I thought caching query
result in PHP will improve performace.
Then I read MySQL documentation and saw that MySQL does have a caching
feature.
So... now I dont know if doing the PHP caching is worth the pain.
Would there be any noticed performace improvement if I cache query
results in PHP, considering that MySQL is already caching the queries?
It depends. Benchmark it on your system; I have no idea where the bottleneck
on your system is, only you can measure that.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Dec 12 '06 #2
Hermann wrote:
My site is a bit slow showing the main page so I thought caching query
result in PHP will improve performace.
Then I read MySQL documentation and saw that MySQL does have a caching
feature.
So... now I dont know if doing the PHP caching is worth the pain.
Would there be any noticed performace improvement if I cache query
results in PHP, considering that MySQL is already caching the queries?

Thanks
MySQL's caching is a start, but only if the queries are your actual
problem.

Do some profiling to see what portions of the code are causing the
slowdown (can be as simple as echoing out microtime() after each
significant logic block).

If the query turns out to be the problem, then verify that your table
schema has any appropriate indexes and check your query to make sure it
is optimized. Only after you've done this should you worry about
caching.

Finally, if the page does not need to be dynamic (ie: something new
every load), then consider caching the entire page as a static version
of itself for a period of time using Smarty or something similar.

- Moot

Dec 12 '06 #3
The generation time of the main page is always less than 0.1 seconds.
Nevertheless, the page takes several seconds to load.
I dont know what is slowing down the loading.

Dec 14 '06 #4

Hermann wrote:
The generation time of the main page is always less than 0.1 seconds.
Nevertheless, the page takes several seconds to load.
I dont know what is slowing down the loading.
It can be bad HTML. Please check that using validator like:
http://validator.w3.org/
This may improve your page load and then it can smooth your page load
also.
All Smiles
Satya Prakash

Dec 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Matthew Bates | last post by:
Hi, I've been using PHP for a while now and I'm beginning to migrate to PHP5. So far, I'm impressed. I need to develop an admin application to enable users to update a website that is built...
0
by: DocFalken | last post by:
Hello, I'm running into some inconsistent query caching. Has anyone run into this and has a solution or better place to look? All of my queries don't violate the caching terms (no Now() or...
0
by: SC | last post by:
I'm developing a site that may eventually have a very large database of users (hopefully, but who knows). Often there will be queries with multiple joins and sometimes may include a few fulltext...
1
by: SC | last post by:
I'm developing a site that may eventually have a very large database of users (hopefully, but who knows). It will be a community website where users can search each other (think Friendster,...
0
by: taras.di | last post by:
Hi everyone, I've come across an extremely strange problem. The exact same query in both mysql command line client, and mysql query browser gives entirely different results. I was hoping someone...
6
by: onnodb | last post by:
Hi all, While working on an Access UI to a MySQL database (which should be a reasonable, low-cost, flexible interface to the DB, better than web-based, much less costly than a full-fledged .NET...
2
by: Peppi | last post by:
Beginners question: I'm a little confused about the working of the mysql-cache. I don't understand the mechanism. What is it exactly you cash ? The result of a query ? And what if there are...
1
by: tomlebold | last post by:
Having problems displaying query results from combo boxes on a sub form, which is on the same form that is used to select criteria. This has always worked form me when displaying query results on...
9
by: jehugaleahsa | last post by:
Hello: I am writing a cute little class that will cache queries against a database. Currently, I am implementing this by storing the command text, parameter values and generated DataRows. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.