Skip to content

Instantly share code, notes, and snippets.

View klizhentas's full-sized avatar
Be kind

Alexander Klizhentas klizhentas

Be kind
View GitHub Profile
[etcd] Jun 26 02:37:17.539 INFO | worker2.dfw.definbox.com: peer added: 'jobs2.dfw.definbox.com'
panic: runtime error: slice bounds out of range
goroutine 277429 [running]:
runtime.panic(0x7e7cc0, 0xeefdaa)
/usr/local/Cellar/go/1.2/libexec/src/pkg/runtime/panic.c:266 +0xb6
github.com/coreos/etcd/third_party/github.com/goraft/raft.(*Log).compact(0xc22a497c40, 0x2d4c30, 0xed49, 0x0, 0x0)
/Users/philips/coreos/etcd-go/src/github.com/coreos/etcd/release/etcd/gopath/src/github.com/coreos/etcd/third_party/github.com/goraft/raft/log.go:583 +0x4bd
github.com/coreos/etcd/third_party/github.com/goraft/raft.(*server).processSnapshotRecoveryRequest(0xc213274900, 0xc21b0c0b40, 0xc21b0c0b40)
/Users/philips/coreos/etcd-go/src/github.com/coreos/etcd/release/etcd/gopath/src/github.com/coreos/etcd/third_party/github.com/goraft/raft/server.go:1321 +0x28c
@klizhentas
klizhentas / case.go
Created August 26, 2014 18:17
RST case
package main
import (
"bufio"
"fmt"
// "io/ioutil"
"log"
"net"
"os"
"reflect"
Frame 316: 66 bytes on wire (528 bits), 66 bytes captured (528 bits) on interface 0
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1 (127.0.0.1), Dst: 127.0.0.1 (127.0.0.1)
Transmission Control Protocol, Src Port: 48879 (48879), Dst Port: 45921 (45921), Seq: 16, Ack: 39, Len: 0
No. Time Source Destination Protocol Length Info
317 1574.120058000 127.0.0.1 127.0.0.1 TCP 74 45922 > 48879 [SYN] Seq=0 Win=43690 Len=0 MSS=65495 SACK_PERM=1 TSval=1478536 TSecr=0 WS=128
Frame 317: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface 0
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
func CloneListener(l net.Listener) (net.Listener, error) {
t := l.(*net.TCPListener)
file, err := t.File()
if err != nil {
return nil, err
}
return net.FileListener(file)
}
@klizhentas
klizhentas / benchmark.go
Created November 8, 2014 05:22
Benchmark
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/mailgun/metrics"
"github.com/mailgun/timetools"
./wrk -c 16 -d 10 -t 2 -R 13000 http://localhost:8181/
Running 10s test @ http://localhost:8181/
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 20.74ms 23.54ms 87.94ms 77.19%
Req/Sec -nan -nan 0.00 0.00%
129968 requests in 10.00s, 15.99MB read
Requests/sec: 12997.76
Transfer/sec: 1.60MB
user www-data;
worker_processes auto;
worker_rlimit_nofile 32000;
pid /var/run/nginx.pid;
events {
use epoll;
multi_accept on;
}
@klizhentas
klizhentas / upstart.conf
Created January 12, 2015 01:32
Nginx upstart
# nginx
limit nofile 40000 40000
description "nginx http daemon"
author "George Shammas <[email protected]>"
start on (filesystem and net-device-up IFACE=lo)
stop on runlevel [!2345]
env DAEMON=/opt/nginx/sbin/nginx
@klizhentas
klizhentas / trace.js
Created January 13, 2015 17:19
Examples of structured logs
// HTTP, captured request and response headers
{"Req":{"Method":"GET","URL":"/hello","H":{"X-Req-A":["1","2"],"X-Req-B":["3","4"]}},"Resp":{"Code":200,"RTT":0.006653,"H":{"X-Re-1":["6","7"],"X-Re-2":["2","3"]}}}
{"Req":{"Method":"GET","URL":"/","TLS":{"V":"TLS12","Resume":false,"CS":"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","Srv":"127.0.0.1"}},"Resp":{"Code":200,"RTT":0.002082,"H":null}}
Jul 28 19:59:13 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad wait-for-etcd.sh[1636]: Error: cannot sync with the cluster using endpoints http://127.0.0.1:4001
Jul 28 19:59:13 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad wait-for-etcd.sh[1636]: Failed to set variable reconnecting to the cluster
Jul 28 19:59:14 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad wait-for-etcd.sh[1636]: Error: cannot sync with the cluster using endpoints http://127.0.0.1:4001
Jul 28 19:59:14 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad wait-for-etcd.sh[1636]: Failed to set variable reconnecting to the cluster
Jul 28 19:59:16 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad wait-for-etcd.sh[1636]: cluster is healthy
Jul 28 19:59:16 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad wait-for-etcd.sh[1636]: member ce2a822cea30bfca is healthy
Jul 28 19:59:16 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad etcdctl[1672]: {"Network":"10.244.0.0/16", "Backend": {"Type": "vxlan"}}
Jul 28 19:59:16 7193bd9b-8c8f-4e6d-a817-857cf95fc8ad bash[1688]: waiting for write.
Jul 28 19:59:16 7193bd9b-8c8f-4e6d-a817-857cf9