I am using the Apache Proxy balancer directive to hook up a set of thin servers (for Rails).
Like so:
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000 route=thin0
BalancerMember http://127.0.0.1:5001 route=thin1
BalancerMember http://127.0.0.1:5002 route=thin2
</Proxy>
However, thin can also be configured to use unix domain sockets.
So I want to be able to do something like:
<Proxy balancer://thinservers>
BalancerMember unix://tmp/thin.0.sock route=thin0
BalancerMember unix://tmp/thin.1.sock route=thin1
BalancerMember unix://tmp/thin.2.sock route=thin2
</Proxy>
But Apache is not taking it. Apparently nginx can do it, but I really want to use Apache.
Is there a way?
Unix sockets only live while the program is running, so /tmp/ is usually an alright place for them to live, some programs chose to put them into /var/run/ (since while they are in essence "temporary", they have persistent names).
To create a UNIX domain socket, use the socket function and specify AF_UNIX as the domain for the socket. The z/TPF system supports a maximum number of 16,383 active UNIX domain sockets at any time. After a UNIX domain socket is created, you must bind the socket to a unique file path by using the bind function.
SOCK_DGRAM (compare to UDP) – for a datagram-oriented socket that preserves message boundaries (as on most UNIX implementations, UNIX domain datagram sockets are always reliable and don't reorder datagrams)
The traditional UNIX system calls are blocking. For example: accept() blocks the caller until a connection is present. If no messages space is available at the socket to hold the message to be transmitted, then send() normally blocks.
Short answer, no.
From http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html
It provides load balancing support for HTTP, FTP and AJP13 protocols
So those are the only protocols supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With