Settings

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

AKA Panama Jack wrote:This is not quite true if the database server is handling a number of databases. You will find that a 128 meg read cache on a database server that is hosting multiple databases is constantly flushing data from the cache. You will find that an active database server will be flushing data from the cache on a constant bases and that loading a file will be faster because of the less overhead involved.
In my testing, and my experience running a webhost for over a decade, I found the opposite. Its not a provable point for all situations, its relative to the configuration, the OS, the use patterns, and much more.

Put simply, as I said in the original post, your mileage may vary.
AKA Panama Jack wrote:The speed advantage when seeking for a database like mysql is because it can communicate directly with the filesystem while doing something similar in PHP you have to go through the interpreter layer of PHP to get to the filesystem.
No. You are ignoring two fundamental differences between flat-file access and databases: Relational storage, and caching. Because the data is stored based on its relationship, not in sequential format, seeking is far faster. Its one of the main reasons why a future version of Windows will use a db-driven filesystem. Put another way, seeking sequentially for random data will almost always be slower than direct random access. Otherwise, we'd still be using tape reels for data storage.
AKA Panama Jack wrote:
Roja wrote:As a general statement, on your home PC, yes, a filesystem will often beat the DB. However, on a shared host, setup properly, the db will be extremely competitive, and win in many situations.
I will guarantee you that isn't true for what you are talking about and we host alot of websites as well as one of the largest trucking networks in the world. When it comes to loading configuration data and similar items using a database is one of the worst things you can use for a highly active site, shared or dedicated.
No guarantee neccesary. I've tested it on a wide variety of platforms, and my findings differ from yours. I've hosted some of the largest high-traffic sites in the world, as you have, and I've designed databases for some of the largest enterprises in the world.

I'm glad that on your platforms, in your situation, you've found your optimal solution. I have as well, and they are different. Which is more correct will come down to the individual server, use-pattern, data stored, and more.

It all goes back to my previous statement: Your mileage may vary.
Post Reply