5 分钟

DynamoDB

DynamoDB 是 AWS 的托管 NoSQL 数据库,可以当作简单的 KV 数据库使用,也可以作为文档数据库使用. Data model 组织数据的单位是 table, 每张 table 必须设置 primary key, 可以设置可选的 sort key 来做索引. 每条数据记作一个 item, 每个 item 含有一个或多个 attribute, 其中必须包括 primary key. attribute 对应的 value 支持以下几种类型: Number, 由于 DynamoDB 的传输协议是 http + json, 为了跨语言的兼容性, number 一律会被转成 string …
AWS Database NoSQL server-infra
阅读全文 →
3 分钟

Handle outage

A few weeks ago, production environment came to an outage, solve it cost me 8 hours (from 3am to 11am) although total down time is not long, really a bad expenrience. Finally, impact was mitigated, and I’m working on a long term solution. I learned some important things from this accident. The …
lang-en server-infra
阅读全文 →
2 分钟

AWS DMS notes

AWS’s DMS (Data migration service) can be used to do incremental ETL between databases. I use it to load data from RDS (MySQL) to Redshift. It works, but have some concerns. Take some notes when doing this project. Prerequisites Source RDS must: Enable automatic backups Increase binlog remain …
lang-en AWS DMS data-infra
阅读全文 →
2 分钟

Get all invalid PTR record on Route53

I use autoscaling group to manage stateless servers. Servers go up and down every day. Once server is up, I will add a PTR record for it’s internal ip. But when it’s down, I didn’t cleanup the PTR record. As times fly, a lot of invalid PTR records left in Route53. To cleanup those PTR records …
lang-en AWS route53
阅读全文 →
2 分钟

Build private static website on S3

Build static website on S3 is very easy, but by default, it can be accessed by open internet.It will be super helpful if we can build website only available in VPC. Then we can use it to host internal deb repo, doc site… Steps are very easy, you only need VPC endpoints and S3 bucket policy. AWS api …
lang-en AWS S3
阅读全文 →
4 分钟

旅行散记

前阵子总有点心烦意乱的,生活上的,家里的,堵在一块,弄得自己都有点疲惫了,8月初的时候去日本东北逛了一圈,恰逢当地祭奠密集期,也就凑了把热闹,还挺有意思。 行程: 上海 -> 东京 -> 盛冈 -> 八户 -> 十和田湖 -> 青森 -> 弘前 -> 东京 -> 上海, 满满当当的7天, 懒得贴图,瞎记一点。 盛冈是岩手县的首府,但刚到的时候感觉真是个大乡下啊,大白天,出了车站区域,步行1公里多的时间里只碰到了2个人,一个桥下睡觉的大叔,一个遛狗的,像个鬼城似的,超级不习惯。到了晚上,当地有三飒舞祭典,一下子不知从哪冒出来好多人。大家聚在一起,各 …
阅读全文 →
3 分钟

Use redshift spectrum to do query on s3

使用 redshift spectrum 查询 S3 数据 通常使用 redshift 做数据仓库的时候要做大量的 ETL 工作,一般流程是把各种来源的数据捣鼓捣鼓丢到 S3 上去,再从 S3 倒腾进 redshift. 如果你有大量的历史数据要导进 redshift,这个过程就会很痛苦,redshift 对一次倒入大量数据并不友好,你要分批来做。 今年4月的时候, redshift 发布了一个新功能 spectrum, 可以从 redshift 里直接查询 s3 上的结构化数据。最近把部分数据仓库直接迁移到了 spectrum, 正好来讲讲。 动机 Glow 的数据仓库建在 redshift …
AWS Redshift spark data-infra
阅读全文 →
2 分钟

Enable coredump on ubuntu 16.04

Coredump file is useful for debuging program crash. This post will show several settings related to coredump. Enable coredump If you run program from shell , enable coredump via unlimit -c unlimited, then check unlimit -a | grep core, if it shows unlimited, coredump is enabled for your current …
coredump system ubuntu
阅读全文 →
4 分钟

Python Web 应用性能调优

Python web 应用性能调优 为了快速上线,早期很多代码基本是怎么方便怎么来,这样就留下了很多隐患,性能也不是很理想,python 因为 GIL 的原因,在性能上有天然劣势,即使用了 gevent/eventlet 这种协程方案,也很容易因为耗时的 CPU 操作阻塞住整个进程。前阵子对基础代码做了些重构,效果显著,记录一些。 设定目标: 性能提高了,最直接的效果当然是能用更少的机器处理相同流量,目标是关闭 20% 的 stateless webserver. 尽量在框架代码上做改动,不动业务逻辑代码。 低风险 (历史经验告诉我们,动态一时爽,重构火葬场….) 治标 常见场景 …
glow server-infra
阅读全文 →
3 分钟

Build deb repository with fpm , aptly and s3

I’m lazy, I don’t want to be deb/rpm expert, I don’t want to maintain repo server. I want as less maintenance effort as possible. 🙂 Combine tools fpm, aptly with aws s3, we can do it. Use fpm to convert python package to deb fpm can transform python/gem/npm/dir/… to deb/rpm/solaris/… packages …
lang-en aptly fpm server-infra
阅读全文 →