Skip to content

Instantly share code, notes, and snippets.

=*= MySQL Group Replication =*=
===============================
The multi master plugin for MySQL is here. MySQL Group Replication
ensures virtual synchronous updates on any node in a group of MySQL
servers, with conflict handling and failure detection. Distributed
recovery is also in the package to ease the process of adding new
nodes to your server group.
@rbranson
rbranson / gist:03d88e3733c6ee098a89
Last active July 25, 2017 15:17
My Thoughts on Rust

Rust is the first language that has emerged in the past few years that solves enough of my problems that it would be worth not only learning & teaching an entirely new language, but also sacrificing the maturity of the language ecosystems I’ve become accustomed to.

I highly suggest you read the "Guide" provided by the language developers or this won't make much sense. These are just some of my thoughts and are intended to highlight particular things that stand out to me. I am just a practitioner and not an expert in any of these languages, so I have probably made some incorrect assumptions and out-of-date assertions. Bare with me.

Rust feels like the first time momentum has gained behind a true systems programming language that uses modern PL design techniques to prevent common errors when dealing with memory. It seems like others have previously either been too anemic to be worth adopting or too abstract to provide proper control. The type system and assignment semantics are designed specifically to preven

public void antiCleanup(String ksName, String cfName)
{
if (ksName.equals(Table.SYSTEM_KS))
throw new RuntimeException("Anti-cleanup of the system table is neither necessary nor wise");
Set<String> tableNames = Sets.newHashSet();
if (ksName == null)
{
for (Table table : Table.all())
tableNames.add(table.name);
@rbranson
rbranson / gist:6384408
Created August 29, 2013 22:54
Slow by-name queries.
=== 1000 columns, 1 byte values, name query for 1 column ====
activity | timestamp | source | source_elapsed
---------------------------------------------------------------------------------------------+--------------+-----------+----------------
execute_cql3_query | 15:50:29,993 | 127.0.0.1 | 0
Parsing select * from "ColumnPerfTest" where key = 826312 and column1 = 222970 LIMIT 10000; | 15:50:29,993 | 127.0.0.1 | 55
Peparing statement | 15:50:29,994 | 127.0.0.1 | 423
Executing single-partition query on ColumnPerfTest | 15:50:29,994 | 127.0.0.1 | 920
Acquiring sstable references | 15:50:29,994 | 127.0.0.1 | 936
@rbranson
rbranson / gevent-spawn-and-yield.py
Created August 29, 2013 05:19
Illustrates how to launch & yield to gevent greenlets from a non-gevent context.
import gevent
from gevent import httplib
def fetcher():
print "fetcher: Fetching..."
conn = httplib.HTTPConnection("www.google.com")
conn.request("GET", "/")
res = conn.getresponse()
output = res.read()
@rbranson
rbranson / gist:6374357
Created August 29, 2013 04:45
By-Name Queries are Slow
[default@inbox] get LegacyMediaToUserMap[1][64567];
=> (name=64567, value=1043, timestamp=1377731866330548)
Elapsed time: 7.65 msec(s).
[default@inbox] get LegacyMediaToUserMap[1][64567];
=> (name=64567, value=1043, timestamp=1377731866330548)
Elapsed time: 5.89 msec(s).
[default@inbox] get LegacyMediaToUserMap[1][64567];
=> (name=64567, value=1043, timestamp=1377731866330548)
Elapsed time: 6.37 msec(s).
[default@inbox] count LegacyMediaToUserMap[1];
#!/usr/bin/env python
import math
import random
from collections import defaultdict
from operator import itemgetter
def average(ary):
@rbranson
rbranson / gist:5600422
Created May 17, 2013 16:54
why I love #cassandra
[09:46:29] <canyouhelpme> i want to go with cassandra I HATE MYSQL
[09:46:51] <rcoli> if you hate mysql, you're really going to hate cassandra.
[09:47:23] <canyouhelpme> really?
[09:48:00] <rcoli> yes, really. mysql is much more robust, mature and comprehensible than cassandra, in general.
# Cassandra storage config YAML
# NOTE:
# See http://wiki.apache.org/cassandra/StorageConfiguration for
# full explanations of configuration directives
# /NOTE
# The name of the cluster. This is mainly used to prevent machines in
# one logical cluster from joining another.
cluster_name: XXX
#!/usr/bin/env python
import byteplay
import __builtin__
class Foo(object):
def a_global(self):
return True
def a_const(self):