MySQL Forums
Forum List  »  Router & Proxy

Re: Proxy pool member. How to...?
Posted by: Maxim Volkov
Date: September 11, 2007 02:37AM

At first I tried load balancing without a script (better say using script to only print out proxy.connection.backend_ndx in connect_server() function). Result: the first server out of five was executing queries. By reading previous post about 1ms connection time now I understand why round robin wasn't happening in this case.

Tried script from (http://dev.mysql.com/doc/refman/5.0/en/mysql-proxy-scripting-connect-server.html).
Result: Error --> (connect_server) /opt/dba/mysql-proxy/share/connect.lua:4: attempt to index field 'connection' (a userdata value). Wondering what is happening there.

Tried own improvised load balancing script with 6 servers behind proxy:
--------------------------------------------------
-- m.lua
function connect_server()

print ("~~> " .. proxy.connection.backend_ndx)
id = (math.random(1,10000) % 6) + 1
proxy.connection.backend_ndx = id
print ("~~> " .. proxy.connection.backend_ndx)
print("Choosing backend" .. id)
print("Using " .. proxy.servers[id].address)
end
------------------------------------------------------

Randomization works perfectly. However, proxy.connection.backend_ndx = id fails again. I guess there is a deeper issue with it.

Options: ReplyQuote


Subject
Views
Written By
Posted
6878
September 10, 2007 05:08PM
3024
September 10, 2007 11:52PM
3315
September 11, 2007 12:58AM
3200
September 11, 2007 01:35AM
Re: Proxy pool member. How to...?
3232
September 11, 2007 02:37AM
2982
September 11, 2007 03:38PM
2834
September 12, 2007 03:42PM
2904
September 12, 2007 05:03PM
2812
September 13, 2007 01:45AM
3010
September 13, 2007 03:16PM
2885
September 13, 2007 03:38PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.