grobian / carbon-c-relay

Enhanced C implementation of Carbon relay, aggregator and rewriter
Apache License 2.0
380 stars 107 forks source link

how to config c-relay open more than one output connection? #278

Closed toopa2002 closed 7 years ago

toopa2002 commented 7 years ago

Hi, I have set up the environment as follow pic. blank diagram - page 1

The C-relay-ingestion has responsibility for forwarding metric data from client to load balancer in front of Graphite node as following config.

cluster send-through
forward
       graphite-vip:2003
;
match *
send-to send_through
stop;

With this setting C-relay-ingestion open only 1 connection to Graphite-vip. This make metric ingest to only one graphite node.

I have try to use "fnv1a_ch" hash to open more connection to Graphite-VIP as below, but it make the error "cannot set instance 'a02' for server Graphite-VIP:2003: server was previously defined with instance 'a01'"

cluster hash
    fnv1a_ch
    Graphite-VIP:2003=a01
    Graphite-VIP:2003=a02
    Graphite-VIP:2003=a03
    Graphite-VIP:2003=a04
    ;
match *
  send to hash
  stop
  ;

Are there anyway set c-relay as a proxy to balance the load and open more than 1 connection to Graphite-VIP?

grobian commented 7 years ago

Each destination is a single connection, why do you want more than 1 connection? It shouldn't improve throughput in any way AFAICT.

toopa2002 commented 7 years ago

Hi @grobian , In my case the destination of C-relay-Ingestion is loadbalancer (Graphite-VIP) and behind this loadbalancer are 12 graphite nodes. I want metrics to be equally distributed from loadbalancer to 12 graphite nodes. The problem I found at this time is the metric only send to 1 Graphite node and found many metric drop.

piotr1212 commented 7 years ago

@toopa2002 Do you really need the loadbalancer? c-relay can load balance as well (see any_of) and is protocol aware (i.e. can buffer/resend/try to be consistent). IMO the loadbalancer just makes your design more complex and lowers the availability (more components in serial in the chain).

P.S. Not knowing your specific use case but you could probably drop the second relay on the cache hosts (c-relay-internal) as well. Or even not run relays at all on the cache hosts.

grobian commented 7 years ago

I also feel you should cut the loadbalancers out of the picture for the graphite traffic. If possible, run carbon-c-relay in -s mode at the client machine to send metrics to your dedicated c-relay machines which directly send to all the carbon-caches.

grobian commented 7 years ago

@toopa2002 do you need more help/info/changes for this issue?

toopa2002 commented 7 years ago

@grobian , thank you. I'm considering to remove LB from this picture as you recommend.