bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000
... wait a minute ...
This content from this markdown file has moved a new, happier home where it can serve more people. Please check it out : https://docs.microsoft.com/azure/azure-cache-for-redis/cache-best-practices.
// Tarantool quick test | |
// Copyright, Dennis Anikin 2016 | |
// | |
// Quick disclaimer: | |
// | |
// This test shows 500K-1000K transactions per second on one CPU core | |
// and 600K-1600K queries per second on one CPU core. | |
// | |
// Based on the $6.57 per-month-price for the AWS t2.micro instance we can afford the tremendous number of 630bln queries for just $1 | |
// |
import com.twitter.algebird.HyperLogLog | |
import com.twitter.algebird.HyperLogLogMonoid | |
import com.twitter.algebird.HLL | |
import org.apache.commons.codec.binary.Base64 | |
import com.twitter.chill.algebird.AlgebirdRegistrar | |
import com.twitter.chill.{KryoPool, ScalaKryoInstantiator} | |
// base 64 encoded string | |
// val data = List(1, 1, 2, 2, 3, 3, 4, 4, 5, 5) |
package controllers | |
import java.util.Properties | |
import com.typesafe.config.ConfigFactory | |
import kafka.consumer.{Consumer, ConsumerConfig, ConsumerConnector, Whitelist} | |
import kafka.serializer.StringDecoder | |
import play.api.libs.iteratee.{Enumerator, Iteratee} | |
import play.api.mvc.{Controller, WebSocket} |
import java.util.Arrays; | |
/** | |
* quickselect is a selection algorithm to find the kth smallest element in an | |
* unordered list. Like quicksort, it is efficient in practice and has good | |
* average-case performance, but has poor worst-case performance. Quickselect | |
* and variants is the selection algorithm most often used in efficient | |
* real-world implementations. | |
* | |
* Quickselect uses the same overall approach as quicksort, choosing one |
The following recipes are sampled from a trained neural net. You can find the repo to train your own neural net here: https://github.com/karpathy/char-rnn Thanks to Andrej Karpathy for the great code! It's really easy to setup.
The recipes I used for training the char-rnn are from a recipe collection called ffts.com And here is the actual zipped data (uncompressed ~35 MB) I used for training. The ZIP is also archived @ archive.org in case the original links becomes invalid in the future.
import shapeless._ | |
/** | |
* Functional update of common fields of an *open* family of case classes | |
* via a case-class-like copy through the common super type ... | |
* | |
* This is a follow up to my earlier post showin how to do functional | |
* update for a sealed family of case classes, | |
* | |
* https://gist.github.com/milessabin/a212d946aef33811fee1 |
OK, you can pretty much ignore what I wrote below this update, because it doesn't really apply anymore.
I wrote this over a year ago, and at the time I had spent a couple of weeks trying to get Kafka 0.8 working with .NET and then Node.js with much frustration and very little success. I was rather angry. It keeps getting linked, though, and just popped up on Hacker News, so here's sort of an update, although I haven't used Kafka at all this year so I don't really have any new information.
In the end, we managed to get things working with a Node.js client, although we continued to have problems, both with our code and with managing a Kafka/Zookeeper cluster generally. What made it worse was that I did not then, and do not now, believe that Kafka was the correct solution for that particular problem at that particular company. What they were trying to achieve could have been done more simply with any number of other messaging systems, with a subscriber reading messages off and writing