New version: unix-sockets-patch-2001-03-13T2245Z.gz
To force myself to get my feet wet in Webware, I created a patch to add support for unix domain sockets. unix-sockets-patch-2001-03-13T1135Z.gz I did it because I wanted to try a "minor" enhancement. It ended up being a lot more work than I ancipated, but I learned a lot.
I have tested it lightly with WebKit.cgi, and it works for me. Subjectively, it seems a little faster, but I have not done real time comparisons with INET sockets.
It doesn't work on Windows or Mac (pre MacOS X). (This is a platform bug. :-) ) I know that NT supports named pipes, but I don't know how to use them from Python, and I don't have a Windows box to test it on.
My tabs may not be exactly right.
I did not change any C code in mod_webkit. (I would expect to see more improvement here than in WebKit.cgi)
Does FastCGI support unix sockets at all?
patch is bad Monitor.py is using the wrong filename for the client socket.
"Host": "localhost", "Port": 8086,becomes
"SocketAddress": ("localhost",8086),The Unix socket name is passed through serverSidePath()
"SocketPermissions": 0666,If you do not include this setting, the socket will have the default permissions (i.e. AppServer will make no chmod call.)
"Host": "localhost", "Port": 8086, "MonitorPort": 8085,or
"SocketAddress": "var/AppServer.sock", "MonitorPort": "var/AppServer.sock.monitor",
Note that it is possible to use AF_INET for the AppServer and AF_UNIX for the monitor (or vice versa), but the default is to use the same address family.
SocketPermissions is not applied to the monitor port. Convince me that it is necessary and I will add it.
The Unix socket name is passed through serverSidePath()
These are ripe for refactoring: they have a lot of duplicate code. Should it be pushed down into AppServer?
I changed transactWithAppServer to require a single argument "address" in place of the previous "host","port" pair. I fixed all callers of this method. Then I added a method connectToAppServer(self,address) that parses the address, creates an appropriate socket, and connects to it. This allowed me to eliminate the "host:port" parsing that was done in three different ways in five different places.
The unix socket name is joined with WebKitDir.