- GoogleのSRE: 最適化に時間を使う
- コンピューティングリソースだけでなく、時間の使い方も最適化する
- トイルに時間を使いたくない
- トイルに関する包括的な話はSRE本の5章参照
- この章でのトイルの定義:
- サービス維持に関するもので、繰り返され、予測可能な一連のタスク
- 本番運用にトイルは避けられない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
2つのスタイルの並行処理
- CSPモデル
- プロセス間で直接相互通信をしない (?)
- Goでは独立したプロセスとしてゴルーチンを使い、相互通信のためにチャネルを用いる(?)
- 伝統的な共有メモリマルチスレッディング
- 他の言語では一般的にスレッドが使われる
- Ch.9で取り扱う
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"testing" | |
) | |
type User struct { | |
ID int | |
a int | |
b int64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "qiita" | |
require "slack-notifier" | |
require "aws-sdk" | |
require 'yaml' | |
require 'json' | |
class RDSLogDownloader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# original from http://sandrinodimattia.net/posting-successful-ssh-logins-to-slack/ | |
if [ "$PAM_TYPE" != "close_session" ]; then | |
whitelist="127.0.0.1 localhost" # change here | |
is_white=0 | |
# check authorized host | |
for HOST in $whitelist |