Louis-Philippe Gauthier

Head of Engineering @ Samsung Ads

Read this first

Ownership as code

In software development, ownership is a term that’s often thrown around but poorly understood. What does it mean to own something? Why is this something we strive to attain?

At Samsung Ads, the engineering team had been growing very rapidly (2x yearly) over the last 3 years and it’s become clear that ownership is something critical. Who owns that codebase? Who’s responsible for the uptime of that service? Who should I reach out to if the service goes down? When you’re a startup these questions are trivial, but as you grow things becomes messy (shared monolith, old codebases, etc).

What is code ownership?

Before we continue, I think it’s important to define what is ownership. Code ownership can be broken down into 3 facets:

Responsibility

If you own a codebase, you should be responsible for it. You should care that it’s well maintained and make sure that it gets the right level of...

Continue reading →


Disabling erl_crash.dump

To disable erl_crash.dump you can use the ERL_CRASH_DUMP environment variable. You need to give it a path that doesn’t exists so that open returns a value < 0.

export ERL_CRASH_DUMP=/disable/crash/dump

https://github.com/erlang/otp/blob/maint/erts/emulator/beam/break.cL757

View →


Strcmp

strcmp(<<>>, <<>>) -> 0;
strcmp(<<>>, <<_A:1/binary, _Rest/binary>>) -> -1;
strcmp(<<_A:1/binary, _Rest/binary>>, <<>>) -> 1;
strcmp(<<A:1/binary, Rest/binary>>, <<A:1/binary, Rest2/binary>>) -> strcmp(Rest, Rest2);
strcmp(<<A:1/binary, _Rest/binary>>, <<B:1/binary, _Rest2/binary>>) when A < B -> - 1;
strcmp(<<_A:1/binary, _Rest/binary>>, <<_B:1/binary, _Rest2/binary>>) -> 1.

View →


Performance Optimization 101 - Erlang Factory SF 2014

In order to scale AdGear’s real-time bidding (RTB) platform, we’ve been optimizing system and application performance. In this talk, I’ll share all my findings, from basic tips to advanced topics. I’ll cover coding patterns, metric collection, tracing and much more!

Talk objectives:

  • Share basic tips, common pitfalls, efficient coding patterns
  • Introduce tooling for metric collection (statsderl, vmstats, system-stats, riak_sysmon)
  • Highlight erlang trace (fprof, flame graphs)
  • Expose advanced topics (VM tuning, lock-counter, systemtap, cpuset)

Target audience:

  • Anyone looking to improve the performance of their Erlang application.

Video -
Slides

Continue reading →


Fast Tuple Shuffle (Fisher-Yates)

Fisher–Yates shuffle

shuffle(Tuple) ->
    shuffle(Tuple, size(Tuple)).

shuffle(Tuple, 1) ->
    Tuple;
shuffle(Tuple, N)->
    Random = erlang:phash2(os:timestamp(), N) + 1,
    A = element(N, Tuple),
    B = element(Random, Tuple),
    Tuple2 = setelement(N, Tuple, B),
    Tuple3 = setelement(Random, Tuple2, A),
    shuffle(Tuple3, N - 1).

View →