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.
Do Apache virtual hosts perform better when listening to different ports?
apache;virtualhost;proxy
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.