[Mongrel] mongrel thread safety and global variables
luislavena at gmail.com
Fri Sep 1 19:50:16 EDT 2006
On 9/1/06, hemant <gethemant at gmail.com> wrote:
> So, can't be a issue with my ConnectionClass, right?
> Basically this UNIXSocket that i connect(sorry for confusion, its actually a
> UNIXSocket ) , is a proxy between actual data vending servers and rails.It
> serves multiple clients(not only rails client, other clients connect to it
> using TCPSockets) and is written to support multiple concurrent connections.
> But if I can confirm that there is no issue, with rails connections, then we
> can inform the other team(i am not author of this proxy server), that please
> have a look at your code, and see if its thread safe.
UNIXSocket is like file sockets, right? that means One process
accessing it could put garbage IF other process jump into the socket.
Someone correct me if I'm wrong, but multiple mongrel running from the
same file socket will produce the behavior you're getting (misplaced
stuff in the replies).
> We have been initially using DRb, but there was a issue with connection
> pooling.Besides, fetching data in real time from data vending servers was
> costly, hence this proxy does caching and all that stuff. As per my
> understanding, the proxy is written like, for each connection it will create
> a new thread, and a new thread for putting the data to other data vending
> servers and another thread for receiving the response and sending back to
> all the connected clients.It attaches unique ids to each request, to make
> sure that, no data mis-match occurs.
A pool of connections (one implemented around multiuser protocols...
TCPSocket) is my suggestion.
If your ConnectionClass could connect to your vending server using a
TCP Socket, it will work fine under multiple mongrels.
> But if it would have been written with druby, then it would be a little
> difficult for other clients to connect.
> Thanks for help Zed.
Leaders are made, they are not born. They are made by hard effort,
which is the price which all of us must pay to achieve any goal that
More information about the Mongrel-users