Forum Moderators: phranque
ServerAlias directive within the main VirtualHost for each domain: [httpd.apache.org...]
Will a big number of VirtualHost and/or ServerAlias affect performance? And what's too many?
The answer to all this is: "It depends".
Most work is done by the webserver in taking HTTP requests, looking for the desired files in the filesystem, reading them and sending them out to the internet, additionally firing up interpreters for various PHP and CGI-BIN scripting stuff and sending SQL requests to database systems, where -- depending on the scripting logic -- even more (more as in "much more") performance will be needed.
Given this picture, it does not matter, if a vhost's alias list is longer or shorter -- ("if alias1 or alias2 or alias3 then the config of vhost1 apply").
And as to the number of vhosts, although the webserver has to memorize its vhosts definitons somewhere, this may be totally neglectable compared to the machines total memory and the overall workload.
Performance-wise, it is only important, how much traffic and how much scripting is going through the webserver in total.
It does not matter much, if you have
-- 10 vhosts being targeted with 1000 requests each, or 100 lame vhosts each being targeted with 100 requests, or one vhost being targeted with 10000 requests and 999 vhosts sitting idle: it is both 10000 requests the webserver would have to handle over the same given period.
Although I personally do not run such scenarios, cheap web hosters are said to put up to 1000 customer vhosts or more on one cheap Intel Linux box, in the strong hope that most vhosts are just some small greeting pages like "Hi I am Willie, and I don't know why you want to see my stuff" on 'small' web plans.
So the overall answer is: the number of vhosts does not really matter. Just go ahead and start. If a given sum of vhosts start to produce too much overall load, get an additional box to add all further vhosts there.
Regards,
R.