Currently i am running a squid server to load balance between 2 server using round robin.

But after running for few days, i found out that the server 1 is getting slower. Is there anyway I can use CPU Performance to determine which server should get more user using squid?

Thank you


Squid is not smart enough for this. As the squid documentation says:

Squid treats all round-robin parents equally. It is not currently possible to, e.g., forward 25% of the requests to one parent and 75% to another.

IPVS and haproxy have several algorithms available like weighted round-robin, least connections, and so on. But they don't have a built in mechanism to do this by CPU load on the real servers.

On one IPVS installation that I manage, we have a cronjob that SSHes into each server and grabs the load from /proc/loadavg. Based on the load, it calculates an appropriate weight. Using the ipvsadm command, the weight for that real server is then tweaked. Works great and causes almost equal loads on each server.

Keep in mind that load isn't the only thing to look at. Average response time may be more accurate representation of user experience.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.