Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I plan to use mod_proxy to route requests to Apache virtual hosts based on the URL. example.com/foo/x is routed to foo.example.com/x, example.com/bar/x is routed to bar.example.com/x, etc.

Are there any performance reasons for the virtual hosts to listen to different ports (and to use mod_proxy to route requests to those ports accordingly) or do they perform as well when they all listen to the same port? I'm thinking about having them all listen to the same port for simplicity.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Stick with the same port. Port numbers are only used to initiate a connection, then they are moved to a pseudo-random port that's really high and likely not in use. The data transfer does not happen on port 80 for example. (To test this, run iptraf on your server and then download a large file from another computer. You'll notice that it's probably in the tens-thousand range).

Plus, if you are running the VirtualHosts (listening for, I should say) on the same server, wouldn't it use MORE resources to listen on all these different ports rather than port 80 (or what you use) and listen only for the name? Using the mod_proxy is like walking to work then walking around the building a few times. It's not necessary.

Hope this answers your question.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.