DEV Community

Discussion on: Web cache server HTTP/2 performance benchmark: nuster vs nginx

Collapse
nuster profile image
Nuster Cache Server Author • Edited

Hi,

You don't need haproxy and nuster work together. You can use nuster as a http loadbalancer just like haproxy as nuster is built on top of haproxy and inherits all features of HAProxy, it's 100% compatible with HAProxy.

So suppose you have haproxy in /usr/local/bin/haproxy and haproxy conf in /etc/haproxy/haproxy.conf.

What you need to do is to install nuster, say /usr/local/nuster/bin/haproxy. And if you run /usr/local/nuster/bin/haproxy -f /etc/haproxy/haproxy.conf, nuster will work just like haproxy.

In order to enable cache, update /etc/haproxy/haproxy.conf this way:

Add nuster cache on into global section, and nuster cache on and some rules nuster rule into backend section

So your /etc/haproxy/haproxy.conf looks like this:

global
    # your original conf here
    # add this:
    nuster cache on data-size 1g
#....
frontend your-original-frontend
    bind *:80 #
    mode http
    #...
backend your-original-tomcat-backend
    mode http
    # add following two lines
    nuster cache on
    nuster rule all ttl 0
    # end here
    server your-tomcat-server tomcat-ip:tomcat-port

Then kill original haproxy process, and start nuster: /usr/local/nuster/bin/haproxy -f /etc/haproxy/haproxy.conf

That's it.

you can check which haproxy version is nuster based on here: github.com/jiangwenyuan/nuster/blo...

Collapse
patricklbs profile image
patricklbs

Thank's a lot for your reply, J like what I see :)

Can you tell me which section you put the stats tag:
nuster cache on uri / nuster / cache

is it the same as the haproxy stats I guess not?
I would like to do surveys with and without nuster, to see the differences and thus convince of the good choice of nuster! Again thank you, I hope that Nuster has a nice day ahead of him :)

Thread Thread
nuster profile image
Nuster Cache Server Author

Hi, you should put it in global section,

global
    nuster cache on uri /_any/path/would/do
...

It's not haproxy stats(web page nor cli), you can get the stats using curl http://127.0.0.1[:port]/_any/path/would/do.

Thread Thread
patricklbs profile image
patricklbs
global
    log         127.0.0.1 local2
    chroot      /var/lib/haproxy
    stats timeout 2m
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon
    nuster cache on data-size 1g
    # turn on stats unix socket
    stats socket /var/lib/haproxy/haproxy.sock mode 660 level admin
    stats timeout 2m
    nuster cache on uri /nuster/stats
curl http://127.0.0.1/nuster/stats 

<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>

I forgot something ?

Thread Thread
patricklbs profile image
patricklbs • Edited

How to configure port for stats view, because frontend listen on port 80 :/

Thread Thread
patricklbs profile image
patricklbs

Ok I found it

nuster cache on data-size 1g uri /nuster/stats

Thread Thread
nuster profile image
Nuster Cache Server Author

Hi, you can use the port defined in frontend