Instantly share code, notes, and snippets.

View interactive-queries_song-id.md
# Get all the top-5 charts across all instances
$ http://localhost:7070/kafka-music/song/9
{
  "artist":"N.W.A",
  "album":"Straight Outta Compton",
  "name":"Gangsta Gangsta"
View interactive-queries_top-five-charts-genre.md
# Get all the top-5 charts across all instances
$ http://localhost:7070/kafka-music/charts/genre/punk
[
  {
    "artist":"Wheres The Pope?",
    "album":"PSI",
View interactive-queries_top-five-charts.md
# Get all the top-5 charts across all instances
$ http://localhost:7070/kafka-music/charts/top-five
[
  {
    "artist":"Hilltop Hoods",
    "album":"The Calling",
View interactive-queries_app-instances-for-a-store.md
# List running app instances that currently manage (parts of) state store "top-five-songs"
$ http://localhost:7070/kafka-music/instances/top-five-songs
[
	{
		"host": "localhost",
		"port": 7070,
View interactive-queries_list-app-instances.md
# List all running instances of this application
$ http://localhost:7070/kafka-music/instances
[
	{
		"host": "localhost",
		"port": 7070,
View hll.py
# Runs HLL experiments, using randomly generated strings as input data.
#
# Requirements
# ============
#
# # https://github.com/ascv/HyperLogLog
# $ pip install HLL
#
#
# How to use
View udaf.java
package com.myorg.ksql.udaf;
import io.confluent.ksql.function.udaf.UdafFactory;
import io.confluent.ksql.function.udf.UdfDescription;
@UdfDescription(name = "totalStringLength", author = "Confluent", version = "1.0")
public class TotalStringLength {
@UdafFactory(description = "sums the length of strings")
public static Udaf<String, Long> createSumLengthString() {
View define-a-struct.sql
CREATE STREAM orders (orderid VARCHAR, itemid VARCHAR, address STRUCT<city VARCHAR, state VARCHAR, zicode BIGINT>)
WITH (kafka_topic = 'orders_topic', value_format = 'JSON', key = 'orderId');
View docker.sh
$ docker container run --rm \
--net streams_streams-net \
-v /docker/host/path/to/app.jar:/docker/container/path/to/app.jar \
openjdk:8-jre java -jar /docker/container/path/to/app.jar
View gist:548cd72eaec017c475448cb9b2ced258

Notes

  • Good: very quick snapshotting even for large heap spaces (e.g. works if your JVM process would otherwise timeout and die)
  • Bad: such a memory snapshot contains significantly less useful information than YourKit's "enhanced" memory snapshots.

Usage

# 1. Find the relevant JVM pid on the target machine
$ ps ...