Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


[Question] Nginx Load Balancing - What kind of resources does it use?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

[Question] Nginx Load Balancing - What kind of resources does it use?

vovlervovler Member
edited January 2017 in Help

If I buy a VPS and configure it with nginx to load balance what kind of resources will it use?

Will the traffic go through the VPS and consume its cpu, bandwidth, or

the vps is just used as a way to redirect to another vps?

Comments

  • vfusevfuse Member, Host Rep

    It won't use that much resources, just be sure that the backend behind nginx is handeling the requests as quickly as possible.

    I'm running nginx on a 1 core 2gb ram core and it mostly uses bandwidth and about 10-15% cpu doing ~100 requests per second.

  • datanoisedatanoise Member
    edited January 2017

    If it only works as a reverse proxy it won't use much cpu but of course will use bandwidth. You could cache some objects (css, images, static pages) on it to save some traffic and serve your website faster.

  • eva2000eva2000 Veteran
    edited January 2017

    Very little resources for HTTP load balancing with a bit more for HTTPS load balancing but not much at all :)

    As to bandwidth depends on how you set it up. You can install load balancer on same server as nginx backend origins and configure to talk via private internal IP address in which case bandwidth would be less than if load balancer was on separate remote server talking to a public IP. Though if load balancer and origin separate servers are in same datacenter they can talk via private internal IP if your web host supports it.

    I usually, setup nginx load balancer on each of the nginx origin backends and then setup load balancing failover for each load balancer cycling through each nginx loadbalancer + origin backend pairings

    so

    • pair 1: lb1 + nginx1
    • pair 2: lb2 + nginx2
    • pair 3: lb3 + nginx3

    Where each lb1-3 load balancers for all 3 backends, nginx1-3. Then lb1 is primary load balancer which failover to lb2 and then lb3 and if you want adjust the weighting of nginx1-3 for each pair so that the native nginx server backend for the load balancer has slightly less weighting to even things out to take into account the load balancer's overhead. You can also do similar weighting adjustments to lessen cross datacenter/remote public IP bandwidth costs so that the native nginx backend origin has greater weighting than remote nginx backend origins so that more traffic talks via private internal network too and can even break it down by url requests i.e. directory for large static files like images etc.

    But for load balancing i use haproxy more than nginx but looking at nginx more lately.

    Some info https://www.nginx.com/resources/admin-guide/load-balancer/

    Thanked by 1datanoise
Sign In or Register to comment.