Skip to content

Instantly share code, notes, and snippets.

jiangtao7 /
Created April 24, 2017 16:17 — forked from dongjinleekr/
Kafka benchmark commands
## Consumer Throughput: Single consumer thread, no compression
## Consumer Throughput: 3 consumer thread, no compression
bin/ --topic benchmark-3-3-none \
--zookeeper kafka-zk-1:2181,kafka-zk-2:2181,kafka-zk-3:2181 \
--messages 15000000 \
--threads 1
jiangtao7 /
Created April 24, 2017 16:41 — forked from vicenteg/
Kafka Benchmark Commands
export zookeepers=$(maprcli node listzookeepers -noheader)
export bootstrap_servers=$(maprcli node list -columns hostname -noheader -filter csvc==kafka | awk '{ print $1 }' | head -1)
# Producer
# Setup
bin/ --zookeeper $zookeepers --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/ --zookeeper $zookeepers --create --topic test --partitions 6 --replication-factor 3
# Single thread, no replication
import java.util.concurrent.Executors;
import java.util.HashMap;
import java.util.Map;
import org.jboss.netty.bootstrap.ServerBootstrap;
import static;
import org.jboss.netty.handler.codec.http.*;
jiangtao7 /
Created September 25, 2017 05:48 — forked from hkhamm/
Installing Cassandra on Mac OS X

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL"
jiangtao7 /
Created January 3, 2018 15:48 — forked from miketheman/
Adding nodes to a ZooKeeper ensemble

Adding 2 nodes to an existing 3-node ZooKeeper ensemble without losing the Quorum

Since many deployments may start out with 3 nodes and so little is known about how to grow a cluster from 3 memebrs to 5 members without losing the existing Quorum, here is an example of how this might be achieved.

In this example, all 5 nodes will be running on the same Vagrant host for the purpose of illustration, running on distinct configurations (ports and data directories) without the actual load of clients.

YMMV. Caveat usufructuarius.

Step 1: Have a healthy 3-node ensemble

jiangtao7 /
Created May 4, 2018 23:47 — forked from posener/
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.

jiangtao7 / Python3 Virtualenv
Created May 25, 2018 17:53 — forked from pandafulmanda/Python3 Virtualenv
Setting up and using Python3 Virtualenv on Mac

Python3 Virtualenv Setup

  • Python 3
  • Pip 3
$ brew install python3
jiangtao7 /
Created July 10, 2018 05:41 — forked from terrancesnyder/
./ - example with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
jiangtao7 / Jenkinsfile
Created September 6, 2018 20:03 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>
jiangtao7 /
Created September 13, 2018 05:09 — forked from numan/
Example of setting up AWS auto scaling using boto API
The MIT License (MIT)
Copyright (c) 2011 Numan Sachwani
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions: