vhc

package module
v0.0.0-...-8d276cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2017 License: MIT Imports: 5 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Virtual HyperLogLog Counter GoDoc

Highly Compact Virtual Counters for Per-Flow Traffic Measurement through Register Sharing - You Zhou, Yian Zhou, Min Chen, Qingjun Xiao, Shigang Chen

Abstract

Per-flow traffic measurement is a fundamental problem in the era of big network data, providing critical information for many practical applications including capacity planning, traffic engineering, data accounting, resource management, and scan/intrusion detection in modern computer networks. It is challenging to design highly compact data structures for approximate per-flow measurements. In this paper, we show that a highly compact virtual counter architecture can achieve fast processing speed (slightly more than 1 memory access per packet) and provide accurate measurement results under tight memory allocation. Extensive experiments based on real network trace data demonstrate its superior performance over the best existing work.

Usage

import "github.com/seiflotfy/vhc"

...

vhc, _ := New(20, 8)

// increments a counter for foobar
vhc.Add([]byte("foobar")) 

// gets count for foobar
count := vhc.Count([]byte("foobar"))

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sketch

type Sketch struct {
	// contains filtered or unexported fields
}

Sketch is a sketch for cardinality estimation based on LogLog counting

func New

func New(precision, vPrecision uint8) (*Sketch, error)

New returns a VHC sketch with 2^precision registers, where precision must be >= 9 and 8 <= vPrecision <= 10

func (*Sketch) Add

func (vhc *Sketch) Add(f []byte)

Add inserts a value into the sketch

func (*Sketch) Count

func (vhc *Sketch) Count(f []byte) uint64

Count returns count in stream

func (*Sketch) Merge

func (vhc *Sketch) Merge(other *Sketch) error

Merge takes another Sketch and combines it with vhc one, making vhc the union of both.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址