Hello,

I'd like to capture statistics on all calls to my riak_core service and the
execution time of vnode commands. I looked at folsom_metrics, but for a
service that does 10-30k QPS I'm concerned about the overhead introduced of
doing ets calls. Given that, my current plan was to create several
basho_metrics on startup and store the opaque refs using mochiglobal. Then
my service will make module calls to update the metrics. Will using
basho_metrics in that matter cause problems?

Here's what I'm thinking:

-module(freqserver_stats).

-export([ init/0,
            vnode_count/1,
            ... ]).

-define( VNODE_COUNT,     freqserver_stats_vnode_count     ).


...

-define( METRICS,
             [ { ?VNODE_COUNT,     histogram },
               ... ] ).

  -define( STAT(Name), mochiglobal:get(Name) ).

init() ->


    F = fun( { S, Type } , _ ) ->
          Ref = case Type of
                  histogram -> basho_metrics_nifs:histogram_new();
                  meter     -> basho_metrics_nifs:meter_new()
                end,
          ok = mochiglobal:put( S, Ref )
        end,
    lists:foldl( F, [], ?METRICS ).

  vnode_count( Micros ) ->
    basho_metrics_nifs:histogram_update( ?STAT( ?VNODE_COUNT ), Micros ).

I'm also open to better ideas, if people have them. I'm concerned about
back pressure and/or overflowing the message queue if I dedicate a process
to handling these statistics. Let me know if I'm needlessly concerned about
that.

Thanks,
Joel
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to