- select large memory instance
- A machine with 64 GB of RAM is the ideal sweet spot, but 32 GB and 16 GB machines are also common. Less than 8 GB tends to be counterproductive (you end up needing many, many small machines), and greater than 64 GB has problems.
- In general, it is better to prefer medium-to-large boxes.
- create swap using instance store disk, not EBS.
- Disks should be ssd and iops
cfq
(default I/O Scheduler in *nix) is inefficient for SSD, however, since there are no spinning platters involved. Instead,deadline
ornoop
should be used instead. The deadline scheduler optimizes based on how long writes have been pending, while noop is just a simple FIFO queue.
This file contains hidden or 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
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/ | |
--- | |
- hosts: alpine_install | |
user: root | |
tasks: | |
# - name: create a complete empty file | |
# command: /usr/bin/touch /test/test.conf | |
- name: create a new file with lineinfile |
This file contains hidden or 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
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- kill running query | |
SELECT pg_cancel_backend(procpid); | |
-- kill idle query |
This file contains hidden or 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
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | |
import cgi | |
# import CRUD Operations from Lesson 1 ## | |
from database_setup import Base, Restaurant, MenuItem | |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import sessionmaker | |
# Create session and connect to DB ## | |
engine = create_engine('sqlite:///restaurantmenu.db') |
This file contains hidden or 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
★ Install of core/ffmpeg/3.3.2/20170710172745 complete with 0 new packages installed. | |
crawler-development: Resolved dependency 'core/ffmpeg' to /hab/pkgs/core/ffmpeg/3.3.2/20170710172745 | |
crawler-development: WARN | |
crawler-development: WARN The following runtime dependencies have more than one version | |
crawler-development: WARN release in the full dependency chain: | |
crawler-development: WARN | |
crawler-development: WARN * core/gmp ( core/gmp/6.1.0/20170513202112 core/gmp/6.1.2/20170526062114 ) | |
crawler-development: WARN | |
crawler-development: WARN The current situation usually arises when a Plan has a direct | |
crawler-development: WARN dependency on one version of a package (`acme/A/7.0/20160101200001`) |
This file contains hidden or 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
import requests | |
import os | |
import logging | |
import sys | |
import json | |
import base64 | |
class Conf: | |
''' | |
Wrapper on top of consul api to facilitates configuration for Application. |
This file contains hidden or 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
--- MEMORY RELATED | |
--- wal_buffer | |
SHOW wal_buffers; | |
SELECT name,setting,unit,current_setting(name) FROM pg_settings WHERE name='wal_buffers'; | |
--- unix: `getconf PAGE_SIZE``getconf _PHYS_PAGES` ... Linux: `ipcs -l` `sysctl kernel.sem` | |
--- initial parameters of PostgreSQL: https://pgtune.leopard.in.ua/#/ | |
create extension pg_buffercache; | |
\dx pg_buffercache | |
--- pg_buffercache has several columns | |
--- bufferid, the block ID in the server buffer cache |
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic
unset JMX_PORT; bin/kafka-topics.sh --zookeeper X:2181 --create --topic NAME --replication-factor 3 --partitions 3
OlderNewer