Forum Moderators: coopster

Message Too Old, No Replies

Shared script and server load

         

mipapage

6:45 pm on Apr 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey all,

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).

mcibor

9:21 pm on Apr 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Regarding php and mysql I don't think that there will be a much difference in performance. If the files are used much you can put them into the memory for the faster load. Concerning mysql, every query takes about 99% of the server power (to make it as fast as possible), therefore it doesn't matter.

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:).

mipapage

11:23 pm on Apr 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the reply, mcibor.

> 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!

rojer_31

11:39 pm on Apr 9, 2005 (gmt 0)

10+ Year Member



Okay, first off, I may be wrong at what I am about to say here ;)
Without getting too technical, what I can say is that since everything is in the same physical machine, assuming php doesn't have problems with this setup, I can only think of a performance improvement! The reason is simple, the core files of all these sites are the same, so instead of loading seperate files, each time it is called upon, I would assume, that the files are more likely to be cached in the physical memory, resulting in a slightly enhanced performance for the sites concerned.

Again, I may be wrong, but this is plain simple reasoning, without taking into account other possible bottlenecks.

mipapage

9:39 am on Apr 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks rojer_31,

Thats the kind of news I want to hear ;-)

mipapage

1:21 pm on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Monday morning bump!

In Summary:

Would there be a performance hit if I were to run ten sites on the same server with the same set of PHP files?

[files outsite of public_html]
¦
- site one
- site two
- site three
- etc.

Read above for more details.. .

jatar_k

4:25 pm on Apr 11, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



in theory, no, there is no problem doing that

in practice, too many variables to say whether in your setup with those sites if there will at some point be a problem.

mipapage

7:24 pm on Apr 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks jatar_k.

ergophobe

9:09 pm on Apr 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



OTMH...

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.

mipapage

9:46 pm on Apr 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks ergo!

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...)