Skip to content

Instantly share code, notes, and snippets.

View dongjinleekr's full-sized avatar

Lee Dongjin dongjinleekr

View GitHub Profile
@dongjinleekr
dongjinleekr / consumer.sh
Last active August 5, 2024 08:44
Kafka benchmark commands
## Consumer Throughput: Single consumer thread, no compression
## Consumer Throughput: 3 consumer thread, no compression
bin/kafka-consumer-perf-test.sh --topic benchmark-3-3-none \
--zookeeper kafka-zk-1:2181,kafka-zk-2:2181,kafka-zk-3:2181 \
--messages 15000000 \
--threads 1
@dongjinleekr
dongjinleekr / AccumulatingMapValues.java
Created February 7, 2017 07:52
Accumulating Map Values in Java 8
// Uses a function instance with internal state, along with mapping the map values only.
// see: http://stackoverflow.com/questions/23213891/how-to-map-values-in-a-map-in-java-8
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import java.util.function.Function;
import static java.util.stream.Collectors.toMap;
public class Numbers {
private Numbers() {
}
public static boolean valueOf(Boolean b) {
return valueOf(b, false);
}
public static boolean valueOf(Boolean b1, boolean b2) {
if (null == b1) {
@dongjinleekr
dongjinleekr / keybase.md
Created May 5, 2020 09:19
Proof of my identity for Keybase.io

Keybase proof

I hereby claim:

  • I am dongjinleekr on github.
  • I am dongjinleekr (https://keybase.io/dongjinleekr) on keybase.
  • I have a public key ASBY5pir8DtYwtcEP9Ybe3NLsqGgdKjBk_zYOmRoJMdJhAo

To claim this, I am signing this object:

@dongjinleekr
dongjinleekr / unit-testing-hbase-app.md
Created January 27, 2021 09:20
Unit Testing HBase Application

Tested on Hadoop 2.7.7 + HBase 2.0.5.

  1. Add following dependencies:
  • org.apache.hbase:hbase-client:${hbase.version}
  • org.apache.hbase:hbase-common:${hbase.version}
  • org.apache.hbase:hbase-testing-util:test:${hbase.version}
  1. Use HbaseTestUtil to startup a mini cluster in setup/teardown of the suite.
@dongjinleekr
dongjinleekr / 0-kafka-on-k8s.md
Last active June 29, 2022 11:43
Kafka on Kubernetes, minimal configuration

This gist describes how to create a Kafka cluster on Kubernetes with minimal effort.

Dislike to incubator/kafka helm chart, this approach uses wurstmeister/kafka Docker image or its GraalVM equivalent, dongjinleekr/kafka.

Note: This configuration is intended for dev or testing purpose; it may be used in production environment, but I can't give any guarantees in that respect.

Prerequisites

Install Zookeeper with the following helm command:

@dongjinleekr
dongjinleekr / jshell-on
Created May 14, 2022 06:37
jshell-on: A simple script for running jshell with dependencies. (just add the following files to your $PATH directory.)
#!/usr/bin/env bash
JSHELL=$(which jshell)
if [[ -z ${JSHELL} ]]; then
echo "jshell not installed; exit."
exit 1
fi
GRADLE=$(which gradle)