Implement connection failover
Opened this issue · 6 comments
@VaclavDedik hey, i want to contribute in infinispan-py....can i start with this task?
can you hint what exactly is to be done?
@parismita Hi! Of course, I am very glad you are interested in contributing :) I am currently at a ski resort and I have a really bad internet connection, so do you mind waiting till Monday? I'll be back by then and I will be able to get into details about this task. The core of this task is to make sure you can initialize the infinispan client with more connections e.g. like this:
client = Infinispan(servers=[{"host": "<ip-address1>", "port": "<port-number1>"}, {"host": "<ip-address2>", "port": "<port-number2>"}])
When the infinispan client is initialized this way, it should be able to "failover" (i.e. reconnect) to a different server when the current server doesn't work, you can see how it works in the JS client of infinispan.
I want to get into more details but for that, I need a good connection and more time, so I'll provide more details by Monday :)
ok 👍
Right, so the idea is that you will be able to configure the infinispan client to pick between two or more servers if one of the connection fails. There should be a time out period (something like 10 seconds) when the clients waits for a response, if it doesn't get any response, it should try a different server. It should also mark the server that doesn't work with some flag and try to reestablish the connection after some time.
To make this happen, you need to modify the API of Infinispan
class and you need to implement this behaviour in class ConnectionPool
. Or if you have a better idea, sure go ahead :) (e.g. implementing a different connection class for this seems like quite a good idea too). You might also need to make some modifications in class hotrod.Protocol
.
@VaclavDedik
Hi, i want to work on this issue. Can you please tell which setups to install for this. The above talks are very helpful but i am stuck with installation.
You should install virtualenv, you are going to need (sometimes) to switch between three versions of Python (2.7, 3.5 and pypy), you can read how to do that here: http://docs.python-guide.org/en/latest/dev/virtualenvs/
After that, you just need to start the virtual environment (with e.g. source venv/bin/activate
) and run the following command:
pip install -r requirements.txt
That will install all neccessary python dependencies. For development, you will also need to install infinispan 8.2, which you can download here: http://infinispan.org/download/#stable