Forum Moderators: coopster
I have a question that may be better off in the Apache forum, but I'll try here first.
One script to rule them all
I have a cms script that I use on several sites all located with the same host. I finally got around to making some huge organizational changes, and as a result I now can use the exact same set of files - barring a config file and a simple controller - to run all of the sites.
Here is what I was thinking:
Set up all of the application files outside of public_html, and then have the one config file and one simple controller in the root for each site that runs with the CMS.
This works (locally it's running fine and I've tested it live), and I'm loving the whole "easy to maintain" aspect, but what I am wondering is, would there be a performance hit because I have ten sites being run by the same set of files?
This type of stuff is outta my field of view, so any ideas appreciated.
Extra details:
The data for the sites are in separate db's, and a cached version of the pages is built daily (deleted nightly, but rebuilt when a file is first requested).
Moreover, if you use one or more files, you still need to read them, and unless both servers don't write to them (I don't know about cms, but I don't recon that these files are overwritten during normal action) there won't be any problems.
The only performance loss would be if the files were first on separate disks, but I would estimate this at 0.01% difference, or even less.
So in my (humble mumble) opinion you won't get angry clients concerned about loss of speed:)
Best regards
Michal Cibor
BTW This post is really not in the right place:).
> This post is really not in the right place
I'm not so sure, as I'm not concerned about the mySQL queries, and I'm assuming that the behavior of PHP that I am questioning is not dependant on the server type (win vs. apache etc.).
I am wondering how PHP handles using the same physical set of instructions for many different sites, and well, if it doesn't belong here I don't know where it does! ;-)
I know I expressed doubt about that in the first message, but it seems clear to me now that this is a php question.
So back to it...
I'm on shared hosting, one server, 'one' disc. I can't put anything into memory (I'm assuming this, but it just makes sense that I wouldn't be able to do this on a shared server).
So the question is, will it affect the performance of the (php powered) CMS having each site use/access the same physical set of (php) files, or would I be better off having copies of the CMS core within each individual domain? (Remember that the domains are on the same server)
Being on the same disc my gut says no... Ahh and mcibor, wrt "but I don't recon that these files are overwritten during normal action", no they aren't!
Again, I may be wrong, but this is plain simple reasoning, without taking into account other possible bottlenecks.
Like any abstraction layer, I would say that if running ten sites means making the abstraction layer overly complex, you might lose some performance as a secondary issue, perhaps offset by caching and whatever any accelerator does with it.
If on the other hand, using the files over and over again gives you more time to optimize and streamline, having everthing running through one CMS will help in the long run.
I'm guessing these secondary considerations (i.e. how the script interacts with the programmer) will have more of a performance impact than how the script interacts with the hardware.
That said, fire up Apache Bench and have at it with a few different scenarios and see what happens.
The thing to remember, is that all PHP scripts on a given server are running off one set of files - your PHP, Apache, Linux, Mysql binaries - because this tends to be more efficient.
Man, it took me 5 minutes to get past the 'OTMH', I am forum rusty.
There will be some good caching going on, so that should help things along...
making the abstraction layer overly complex
That wasn't really an issue. I actually came across this quite by accident, when I decided that I wanted to move most of the APP out of the actual site root (e.g. public_html) and into 'that un-webaccessible' part.
Then I was like 'man, I have to have ten instances of the app 'up here', one for each site?"
The lightbulb began to dim (it's typically set on energy saver, you know, it goes off since I don't use it) and I eventually got it ;-)
I'm super stoked to give this a go, but client work has me bogged down. No implementing until next week. You should give it a try for your site, you know, that one about the skis :) (I think I'd be too embarassed to share my code...)