4 ms·
"But now suppose that I have a single machine with a single IP address hosting multiple virtual servers, and I want to replicate this setup for each virtual ser
by dedward 16y ago
"But now suppose that I have a single machine with a single IP address hosting multiple virtual servers, and I want to replicate this setup for each virtual server, i.e. I want each virtual server to have its own instantiation of the custom server application. Now I have to manually assign each instantiation of the app to a separate TCP port number. If I have hundreds or thousands of virtual servers on the same machine (Oh? You think that's not reasonable? Can you say "multi-core architecture"?) that can become a serious administrative (to say nothing of security) nightmare."
Not quite sure I'm interpreting you correctly here - but woudln't you be using localhost for this and/or using loopback interfaces?
Also - if you were designing an application that had to scale out to that many cores, you'd be dealing with things at a system level and using sockets anyway. Whether you are opening unix domain sockets or assigning ports, you still have to track and configure everything - and that can still be automated. While it would be a neat feature - it doesn't seem like a terribly necessary one.
Yes, it would be cool if apache could forward things to a local unix domain socket. Agreed there.
But there's no security nightmare unless you create one - in the instance you describe you bind applications to loopback interfaces, either on ports or creating more loopback interfaces. Designing the applications to use TCP sockets rather than unix domain sockets also leaves you with more flexibility when it comes to design decisions later on - you don't have to leave them on the same machine.
ALso - one wouldn't generally use apache for this - one would use something else as a front end these days that's better suited to forwarding requests and dealing with timeouts, resources, etc.
- lisper 16y ago> Not quite sure I'm interpreting you correctly here - but woudln't you be using localhost for this and/or using loopback interfaces? Sure. But you still have to assign a port number. And you still have to make a round trip through the network stack. It's also a potential security hole if you're not careful to configure the server apps to only listen on the loopback interface. > Also - if you were designing an application that had to scale out to that many cores, you'd be dealing with things at a system level and using sockets anyway. Why? Running N servers on N machines is completely straightforward. Why should it not be just as straightforward to run N servers on one machine with N cores? > you still have to track and configure everything - and that can still be automated Of course it can be automated, but automating the assignment of virtual servers to TCP/IP ports is not straightforward. You have to coordinate the port assignment on both the client and the server side. You have potential synchronization issues if one virtual server goes down and another comes up and wants to use the same port as the one that went down. Port numbers are a scarce resource. The file system namespace is essentially infinite. Why make things harder than they need to be?