Skip to content

Instantly share code, notes, and snippets.

@lenary
lenary / 00-intro.md
Last active August 29, 2015 13:56
Guidance Notes for CRDT Performance Issues

I've had one question about subpar performance in Riak 2.0's CRDTs. I thought I'd write this so that people can more easily diagnose these issues, without the CRDT team having to step in every time.

An Example: A Client was having problems with the performance fetching and updating sets. The issue manifested itself with poor fetch performance.

So, how do you go about debugging/diagnosing this?

@bsparrow435
bsparrow435 / get_put_code.md
Last active March 29, 2021 10:33
Get/Put path walk through
@zkessin
zkessin / WhyUseWebmachine.md
Last active December 22, 2015 23:39
Talk Proposal for CodeMesh 2013

Why You should use Erlang for your startup's API

Zachary Kessin zkessin@gmail.com Director of API Product Structure Mostly Erlang Podcast

Building a statup in which an API plays a key part is an increasingly common pursuit. People have used many technologies to build those APIs,

@angrycub
angrycub / force-remove.md
Created September 12, 2013 13:08
`riak-admin force-remove` should not exist.

riak-admin force-remove should not exist.

It's Friday evening, almost time to head out of the office for a nice long weekend. Your Riak cluster has been running along, everything fine. All of a sudden, the SSD in one of your Riak nodes decides to go up in a ball of flames. So you, being the good sysadmin that you are, immediately hop on the phone with your hardware vendor and order a new SSD. They tell you that you'll have it on Monday morning. Clearly you can't leave a broken node in your Riak environment, so you'll want to remove it from the cluster. You sit down at your terminal, hop on to a working Riak node and type

riak-admin force-remove riak@deadnode.mycompany.com

NOOOOOOOOOOOOOOOOOOOOOOOOO!!!!

Step 1: From you logs I have decoded the bucket/key

binary_to_term(<<131,109,0,0,0,9,85,114,108,84,111,83,99,97,110>>).
<<"UrlToScan">>
binary_to_term(<<131,109,0,0,0,61,104,116,116,112,37,51,97,37,50,102,37,50,102,119,119,119,46,97,110,104,114,105,46,110,101,116,37,50,102,37,51,102,102,101,101,100,37,51,100,114,115,115,50,37,50,54,97,109,112,37,51,98,112,37,51,100,55,51,49,49,48>>).
<<"http%3a%2f%2fwww.anhri.net%2f%3ffeed%3drss2%26amp%3bp%3d73110">>

Step 2: Please run the below snippits from riak attach to identify the owning partitions of this bucket/key

simple_test() ->
{ok, EC} = erasuerl:new(),
{ok, Bin} = file:read_file("/usr/share/dict/words"),
{MD, KBins, MBins} = erasuerl:encode(EC, Bin),
[K1, K2, K3, K4, K5, K6, K7, K8, K9] = KBins,
[M1, M2, M3, M4] = MBins,
KBins2 = [undefined, undefined, undefined, K4, K5, K6, K7, K8, K9],
MBins2 = [undefined, M2, M3, M4],
Bin = iolist_to_binary(erasuerl:decode(EC, MD, KBins2, MBins2)).
@bookshelfdave
bookshelfdave / contact.md
Last active December 19, 2015 21:58
Contact language
/* comments */
// comments

Connections, misc

// default connection, this is used if a named connection 
// is not specified in a fetch, put, delete
@ericmoritz
ericmoritz / erlmonad.erl
Last active December 18, 2015 05:39
I think I finally understand monads!
-module(erlmonad).
-compile(export_all).
half(X) when X rem 2 =/= 0 ->
nothing;
half(X) ->
X div 2.
@andelf
andelf / beam_decompile.erl
Created March 19, 2013 03:25
Erlang BEAM file decompile to .erl file
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).