This week I worked mainly on detecting and handling connection failures
between the reverse proxy plugin and the slave servers.

I added configuration options that control plugin behavior related to
handling unavailable servers. The options are as I already described them:
AttemptsCount -> How many attempts to be made, before assuming that the
server is offline.
OfflineTimeOut -> Minimum number of seconds to wait until retrying to
connect to a server that is currently considered to be offline.

If OfflineTimeOut is bigger than zero, then High Availability is enabled
(this is explained in the configuration file as a comment). If disabled,
the balancers are going to be a little faster, it is useful if you are sure
that there is no way your servers will be offline or you want to use monkey
as a parser proof for the http for example.

I store a struct for each slave server. This struct stores information
about the state of the server - for example number of connections (used in
the LeastConnections balancing algorithm) and number of connection failure
and time of last one (for High Availability).

So the connection life-cycle:
1. When the connection arrives, and the loadbalancer picks a server, the
plugin is trying to connect to the slave server. If the connection doesn't
succeed I put the connection timestamp to the server structure as last
wrong connection time, meanwhile I'm incrementing the connection attempts
value.

2. I'm trying the next server of the balancer. If succeed I'm setting to
zero the timestamp and counts in the server structure. On failure I'm back
to step 1.

3. If the connection face server with attempts count bigger than the
configuration value, compares the conntimestamp - lasterrtimestamp <
OfflineTimeOut and ask's for new server without trying to connect,
otherwise try to connect again, to check if the server is online again.

Also I'm currently improving my blog post about the plugin, so I hope to be
updated in 1-2 hours

Git Hub Repository: https://github.com/nikolanikov/monkey
Blog URL: http://nikolanikov.wordpress.com/
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to