|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I’m interested to see what people think about this, hopefully this is the correct forum as the server is Apache running on Linux:
My news page gets around 5000 views a day but is currently in a basic HTML file that I update with the latest news. I’m going to add it to a database to improve functionality so the news will be stored in a MySQL database, but what would be the least resource intensive on a server: Running an SQL query to generate the latest news every time someone visits the page or Including a file into the page every time someone visits the page. (i.e when news is updated in the database an include file is automatically updated). Bare in mind my adverts serving script is also PHP/MySQL so this is already on every page. The include file would be around 10 - 15k, the query would be less as it would only contain the news data and not the HTML to format it as that would already be in the news page. My server is already worked quite hard and I need to move to a more powerful one really but for now I’d like to be as gentle on it as possible, I haven’t got a clue if the I/O required to include the file would be any less resource intensive than running the SQL query. ![]() Cheers Ben |
|
#2
|
||||
|
||||
|
Minimizing SQL queries and optimizing those that you have to run is almost always the best place to save on speed in any web application.
Basically, the fewer SQL queries you run the better, but if you're already incurring the overhead of connecting to MySQL because of your ads then the penalty isn't as great. My gut tells me that pre-creating your HTML file and including it is going to be significantly faster, even if you're still running a query or two to create your pages. Of course, the only way to know is to benchmark! Make your full-SQL system and benchmark that with ab (apache benchmark, included with apache) and then try your "include" system. This should probably be posted in the PHP forum, or maybe even Lounge because it's a general "efficiency" question. |
|
#3
|
|||
|
|||
|
Thanks for your reply Hero, I'll investigate Apache Benchmark and see what the results are.
|
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > Resource usage - SQL Query vs Include file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|