Skip to content

Instantly share code, notes, and snippets.

View taotetek's full-sized avatar
💭
Left for Gitlab. Microsoft still contracts with ICE.

taotetek taotetek

💭
Left for Gitlab. Microsoft still contracts with ICE.
View GitHub Profile
@taotetek
taotetek / credit.c
Last active July 12, 2018 15:11
Updated Credit Based Flow Control Example ( See: http://hintjens.com/blog:15 )
#include "czmq.h"
// DEBUG - set to true for some output
#define DEBUG false
#define TRANSIT_TOTAL 1024 * 1024
#define TRANSIT_SLICE TRANSIT_TOTAL / 4
#define FRAGMENT_SIZE 65536
#define SERVER_HWM (TRANSIT_TOTAL / FRAGMENT_SIZE) * 2
#define TICK_SECONDS 5
if $programname startswith 'haproxy' then {
action(
name="haproxy_tcp"
type="omfwd"
protocol="tcp"
target="someserver.digitalocean.com"
port="514"
)
action(
action(
name="to_local_file"
type="omfile"
ziplevel="4"
template="custom_fileformat"
dynafile="custom_filename"
)
@taotetek
taotetek / fun.c
Created February 27, 2017 01:08
CZMQ code instrumented with Prometheus via Go shared lib.
#include <stdio.h>
#include <czmq.h>
#include "prometheuz.h"
void *sender(void *arg) {
zsock_t *sender = zsock_new_push ("inproc://demo");
while (1) {
zstr_send (sender, "hello");
}
}
GO VERSION 1.7 - BENCHMARKING zeromq/goczmq
--------------------------------------------
go version
go version go1.7.1 linux/amd64
BenchmarkChanneler-8 200000 5371 ns/op 190.64 MB/s
BenchmarkPollerSendFrame1k-8 500000 2863 ns/op 357.62 MB/s
BenchmarkPollerSendFrame4k-8 300000 4063 ns/op 1008.04 MB/s
BenchmarkPollerSendFrame16k-8 200000 8259 ns/op 1983.66 MB/s
BenchmarkProxySendFrame1k-8 1000000 2328 ns/op 439.78 MB/s
@taotetek
taotetek / scatter_gather_results.txt
Created December 24, 2016 15:06
GoCZMQ Scatter Gather Test
BenchmarkScatterGather1k-8 1000000 1995 ns/op 513.18 MB/s
BenchmarkScatterGather4k-8 500000 3365 ns/op 1217.08 MB/s
BenchmarkScatterGather16k-8 200000 6394 ns/op 2562.20 MB/s
PASS

Keybase proof

I hereby claim:

  • I am taotetek on github.
  • I am taotetek (https://keybase.io/taotetek) on keybase.
  • I have a public key whose fingerprint is D2D4 E077 E060 6F84 CABF 4FA2 4905 9E02 3498 810F

To claim this, I am signing this object:

module(
load="imczmq"
)
input(
type="imczmq"
endpoints="@tcp://*:24555"
socktype="PULL"
rule="testme"
)
module(
load="imczmq"
)
input(
type="imczmq"
endpoints="@tcp://*:24555"
socktype="PULL"
)
input(type="imfile" File="/var/log/myfile.log" ruleset="myrule")
ruleset(name="myrule) {
<actions here>
}