Skip to content

Instantly share code, notes, and snippets.

View evalphobia's full-sized avatar

evalphobia

View GitHub Profile
@evalphobia
evalphobia / slicebench_test.gp
Created November 30, 2016 01:58
[Golang] benchmark for unshifting to slice operation
package main
import (
"testing"
)
type User struct {
ID int
a int
b int64
@evalphobia
evalphobia / exec.sh
Created March 9, 2017 08:09
Execute query from the list file to Elasticsearch
#!/bin/bash
# Read user_id from list.txt and executes query to ES.
# Usage:
# $ bash exec.sh list.txt
HOST='http://localhost:9200'
INDEX='index_name_1,index_name_2,my_awesome_index'
LIMIT=1000
OUTPUT='[.user_id, .status]' # jq expression
@evalphobia
evalphobia / 08.md
Last active March 23, 2017 11:38
The Go Programming Language

8 ゴルーチンとチャネル

2つのスタイルの並行処理

  • CSPモデル
    • プロセス間で直接相互通信をしない (?)
    • Goでは独立したプロセスとしてゴルーチンを使い、相互通信のためにチャネルを用いる(?)
  • 伝統的な共有メモリマルチスレッディング
    • 他の言語では一般的にスレッドが使われる
  • Ch.9で取り扱う
@evalphobia
evalphobia / 20170524.go
Created May 24, 2017 12:09
Women Who Go Lineボットの話
// Copyright 2016 LINE Corporation
//
// LINE Corporation licenses this file to you under the Apache License,
// version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
@evalphobia
evalphobia / action.js
Created July 5, 2018 08:14
To fetch Google Calendar event. (Running on Firebase Functions for Dialogflow)
class Action {
constructor(req, res){
this.request = req;
this.response = res;
this.requestSource = (req.body.originalRequest) ? req.body.originalRequest.source : undefined;
this.app = new DialogflowApp({req, res});
console.log('api-v2')
}
@evalphobia
evalphobia / The_Site_Reliability_Workbook.ch01.md
Last active August 24, 2022 14:21
The Site Reliability Workbook: Chapter 1

Ch.1の前に、この本の簡単な説明。

SRE本が教科書/参考書とするとワークブックは問題集。 SRE本は主に原則や哲学を説明していたが、ワークブックはその原則をどのように適用していくかについて説明。 SRE本はGoogle内でのSREの実践例の話だったが、ワークブックはその他の企業(GCPユーザー)での話もあり。

  • Evernote, Home Depot, NY Times, Spotify

1. SREはDevOpsにどのように関わっていくのか

@evalphobia
evalphobia / The_Site_Reliability_Workbook.ch06a.md
Last active January 26, 2019 10:33
The Site Reliability Workbook: Chapter 6 (part A)

Chapter.6 トイルの排除 (Eliminating Toil)

  • GoogleのSRE: 最適化に時間を使う
    • コンピューティングリソースだけでなく、時間の使い方も最適化する
    • トイルに時間を使いたくない
    • トイルに関する包括的な話はSRE本の5章参照
    • この章でのトイルの定義:
      • サービス維持に関するもので、繰り返され、予測可能な一連のタスク
  • 本番運用にトイルは避けられない

オンコール

  • オンコール

    • 緊急対応とその準備
    • SREはよくオンコール対応要員として必要になる
    • SREは必要に応じてインシデントの診断・緩和・修正・エスカレーションをする
    • さらに加えて、緊急でないものについても見ている
  • GoogleのSRE

  • オンコール対応

負荷の管理

  • 100%の時間 利用可能なサービスはない
    • 配慮のないクライアント
    • 50倍の要求
      • (訳注: 上記2つはPokemon Goのことでもある)
    • スラフィックのスパイク
    • 海底ケーブルの切断
  • 私達のサービスに依存するユーザーがいる

SRE: Reaching Beyond Your Walls

  • GoogleでSREの実践を始めて14年経過
  • 最初のSRE本を出してからのこの2年間は興味深かった
    • SREを実践する人や企業が想像以上に増えた
    • Google以外のエコシステムの拡大とSREの将来の予測の難しさ
      • いくつかのトレンドあり
  • この章ではこれまでに見てきたことと結論づけたことを記載