I can't find this info anywhere....

If I have three multisites running off the 'shared code' of the main site...

· do shared modules just get loaded once? I mean, if 4 users are using, say, fckeditor all at the same time on each of the sites, does that mean fckeditor gets loaded four separate times into the server's php memory?

· in terms of general server resources, is it just the same as running four separate websites on the VPS or is it more efficient?

Basically, reading the forums, multisites seem to bring some additional problems and module incompatibilities into the mix so I'm thinking twice about using them. From a admin management side, there is a small gain, but probably not enough to offset the potential difficulties I've read about. However, if there going to be definite benefits with regard to using less server resources (eg. php memory, sql queries, and ram) that might be enough to swing the balance.

Any quick thoughts?
Cheers.

Comments

cog.rusty’s picture

There are no important advantages in the use of resources. Each site will take its own php memory.

I used to have a problem with my shared host's limit on the number of files that I could have, and multisites were very useful for that. You probably don't have this problem on a VPS.

Regarding management, I find multisites easier to manage but others think exactly the opposite.

-Anti-’s picture

Thanks for clarifying.
I've tried searching for this info, but as you can imagine most material is about a
single site on a shared host which has run out of 8mb/16mb of php memory and
the user doesn't have access to php.ini - a very common situation.
I couldn't find any info how multisites affect php memory.

> Each site will take its own php memory

At the moment I have memory_limit set to 96mb.
For one main website and three smaller multisites, do you think I need to increase that?
The server is not doing much image processing, and no video processing at all.

I have 384mb of ram, if that has any bearing on the memory_limit setting.
Another piece of info I can't find out is, what happens if memory_limit is set too high?

> I find multisites easier to manage but others think exactly the opposite

Yep, I watched a good video the other day that outlined the pros and cons of each quite well.
I'd would prefer a multisite set-up myself, as long as I don't have some of the path problems
and module incompatibilities that I've been spotting lately on the forum. It could be just one
more extra headache to worry about.

Cheers.

mm167’s picture

how come u have only 3xx MB ram in 2009?

-Anti-’s picture

That's not my laptop's memory (which is 3gb)!
It's the amount of memory my websites are allowed to use on the server:

· A shared hosting accounts generally allow from 8mb to 64mb of ram.
I had 64mb on mine and it was struggling, so I got a VPS account.

· Almost all VPS packages start off at 384mb guaranteed ram.
· The next step up is usually 512mb. The max I've seen offered on a VPS account is 1gb.
· After that, I suppose you have to get a dedicated server.

A default install of Drupal, with no extra modules, on a live site, needs 16mb minimum.
96mb of php memory is recommended for a live drupal site, more if a lot of media processing is being done.

If I'm running four sites as a multi-site install, and each is like running a separate site, then 4*96= 384mb. But apache/sql/WHM/cpanel/exim will be using an unknown amount of that ram too; probably easily a quarter.

Hence my question... with memory_limit set to 96mb, is 384mb enough for four, small (but busy) websites?

cog.rusty’s picture

Generally, if you allow a site too much PHP memory, the only problem is that if the site runs wild it will hog the resources of the other sites instead of crashing. For this reason you may want to set a reasonable PHP memory_limit in php.ini and maybe increase it for some sites with an ini_set('memory_limit', '96M'); in their settings.php files.

I don't have measurements, but generally you can go far beyond 384MB, in which case your OS's swap file will be used instead of memory, with a performance penalty. I have been experimenting with a XEN based 360MB VPS lately and I have found that I can do things like this successfully (with a performance penalty):

// phpmemory.php

ini_set('memory_limit', '600M');

print 'Base: ' . number_format(memory_get_usage()/(1024*1024), 2) . 'MB<br />';
$pattern = str_repeat("0123456789", 10000);

print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 4000);
print '4000 x 100,000 chars: ' . number_format(memory_get_usage()/(1024*1024), 2) . 'MB<br />';

unset($fill);
print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 5000);
print '5000 x 100,000 chars: ' . number_format(memory_get_usage()/(1024*1024), 2) . 'MB<br />';

unset($fill);
print 'Clear: ' . memory_get_usage() . ' | ';
$fill = str_repeat($pattern, 6000);
print '6000 x 100,000 chars: ' . number_format(memory_get_usage()/(1024*1024), 2) . 'MB<br />';
andrewbenkard’s picture

I'm moving to a VPS with 512M and have been trying to find this answer too, via http://drupal.org/node/434566

My question:
What's more efficient from a memory perspective?
1) drupal multisite with 25 domains
2) 25 separate drupal instances

I found this just now:
"Agreed, there is no particular performance hit from running multiple instances of different versions of Drupal - you simply have however many PHP-based sites running concurrently. However there are potential performance benefits from running multisite, depending on your server setup and how busy the sites are. For example, if you are using a PHP opcode cache then having 100 copies of the same codebase running would need that much more available RAM to store the cached opcodes in memory." at http://drupal.org/node/342680#comment-1142510

(PHP opcode cache, hmmm. A question for my web host)

And:
"Server load is going to come from users, not websites. You could have 100's of websites on a shared host with low traffic and still be responsive. I imagine that many bigger sites require dedicated hardware, sometimes multiple servers for a single domain. I doubt there is any difference between a Drupal multisite and multiple single Drupal sites, beyond the obvious management convenience and elimination of duplicate files (I don't think there's a downside)." at http://drupal.org/node/377474#comment-1281548

(By "server load" does he mean memory and/or bandwidth?)

And then there's this, which is helpful:
http://drupal.org/node/334319

My amateur's interpretation: just because I have 96M allocated for 25 separate sites doesn't mean I need 2400M of RAM throughout the whole day. It seems to come down to frequency of traffic (lower is easier on memory), caching (more is better), and the modules being used (image manipulation is less good during busy times). So as traffic grows, I've got to watch peak memory usage.

It does make me think of another benefit to separate installs; once one site outgrows a VPS environment shared with other Drupal sites, it's easier to extract and move it to another box.

-Anti-’s picture

> I'm moving to a VPS with 512M

Did you get a host? I got mine with eukhost.com and I'm really very impressed with
the service and support, especially since they were amongst the cheapest I found
(in Europe, anyway. Although they have servers in the states too I think).

What I'm really hoping for is for someone to come into the thread and say:

'I have X smallish but busy sites running on my 384mb VPS with 20-30 add on modules
installed/shared, and they zip along nicely with 30 simultaneous users'.

However cog.rusty answered my main question, so many thanks for that.
But I don't want to run that script you posted - it looks... dangerous! lol.

It's a pity though; I was hoping that in a multi-site set-up, modules would only be
loaded once into memory and shared between all the sites. The analogy I was thinking
of was loading four docs into one instance of MSWord, rather than opening four
separate instances of MSWord.

Cheers (and good luck with your VPS)

andrewbenkard’s picture

I am about ready to throw my lot in with wiredtree (with a pretty good coupon http://www.webhostingtalk.com/showpost.php?p=6121225&postcount=1). They will replace a couple of shared hosts that have me capped at 16M.

So the conclusion appears to be that multisite offers no memory-saving benefits on its own.

(Maybe if you and continue bumping this thread, we'll attract even wiser commenters and get a consensus on this important issue.)

WorldFallz’s picture

It's a interesting question-- you might have better luck finding people that can answer in the IRC channels.

ain’s picture

Why don't you guys benchmark it? Although, I'm also pretty certain multisite setup has no performance gains. The point is in the maintenance turnaround.

ain’s picture

I did a quick benchmark with ApacheBench on the similar single site and multisite setups and the outcome isn't bad at all. The compared installations were:

  1. Single site installation of Drupal 6.17 from Drupal.org
  2. Multisite installation of Drupal 6.6 from Debian Lenny. Although there's a version difference and Debian's release lags behind by a number of versions, it has the latest security patches applied.

For more details see Drupal multisite vs single site performance on Debian.