2017 Resolution

I drafted this new year resolution on the plane. Looking forwards to a fruitful year!

Read More

Share

The Data Migration Problem

Migrate the Hotel!
Today I am trying to solve a very interesting problem, I would like to call it the “data migration problem”.

Read More

Share

Soft Skills Programmers Need

Soft Skills

程序员都需要哪些软技能

在某问答网站看到了一个非常很有意思的问题:程序员都需要哪些软技能?前段时间正好看完了一本神书,稍微归纳出一些不成熟的想法:

  • 持续学习意愿
  • 口头表达和写作能力
  • 建立合理预期的能力
  • 管理事务复杂度的能力
  • 个人品牌建设的能力
  • 财务管理能力

下面一一叙述。

Read More

Share

Getting Started With Grafana

Grafana

Preface

When I first saw Grafana, I was astonished by its beauty immediately and I believe it should be the very tools for most dashboard / monitor use cases. This 10,000+ stared project provide a complete solution for metrics and analytics.

Check this live demo and you should feel the same pleasure as I do.

How does Grafana work

In short, Grafana is a metric solution which include UI Render / Query / Data Source features.
UI Render is amazing; Different types of Queries are supported and it provide a wide range of Data source (mostly time series DB) support.

So, to setup a Grafana for our own use, what should we do?

  • First we need to setup the data source.
  • Second, we setup Grafana server and connect it with the data source.
  • Thrid, we feed data into the data source

That’s it!

Setting up

The following article will cover how to set all the stuff up under Mac OSX. Although we have homebrew and pip, but it take more effort than it seems to be.

Graphite as Data Source

First of all, we are going to choose the data source first. Grafana provide a lot of DB support including: Graphite, Elasticsearch, CloudWatch, InfluxDB, OpenTSDB, KairosDB, Prometheus,

I will take Graphite as our primary data source, with the following reasons:

  • powerful data APIs
  • friendly render APIs with image accessing
  • using whisper file to store data, operation friendly
  • overall the design of Graphite is very clean, every layer of the design is scalable.

Read More

Share

技术项目管理随想

Project management

最近看了一些技术项目排雷书,分几个方面总结了一下雷区,以及可以做得更好的地方。

工程质量 & 复杂度控制

  • 预计变化的影响:需求会变化,系统扩展性需要加强,人员在流动。架构师的职责是管理变化,更确切的说,确保变化的影响是受控的。所以以下的技巧是必须的:
    • 只进行小型、增量的改动
    • 写可重复运行的测试用例,经常执行
    • 让编写和运行测试用例变得容易
    • 追踪依赖事项的变化
    • 自动化重复事项
  • 舍弃自作聪明的设计。这样的设计让系统变得脆弱和难以维护。越老实的系统越容易扩展。
  • 关注性能。假如不从一开始就严格控制性能,「暂时不用关注性能」的想法就会在团队中蔓延。很快就变成「不得不马上解决线上的性能问题」。尽早在团队里面传授性能测试工具的用法是很有效的方法,真没那个时间的话,对依赖SQL的团队,普及一下explain的使用和结果解析都会有很大的提高。
  • 要评估系统的扩展性,那就尝试向多个方向增长业务规模,看看哪个方面会先支撑不住,那个就是你下个要关注的方向。
  • 重视界面设计。对于产品的用户来说,用户交互界面才是系统本身。系统的响应速度提高50%当然是好事,但废老大力气的优化很容易就被糟糕的交互带来的坏心情影响。

    Read More

Share

2015-11-14 知乎盐沙龙活动随笔


今天去参加了一下知乎和网易云音乐举办的盐沙龙——《旋律方法论》。主题本是讨论和作词作曲相关的话题,最后扯着扯着,就变成了大咖在探讨行业发展和进行爆料,也是醉了。
不过还是有干货的,特别是小鱼老师啊……简单地记录一下各个老师讲的我觉着有用的东西吧。

Read More

Share

Unit Test 101

The importance of writing unit tests have been heavily discussed. However, reality is cruel. Many developers do not write UT, and even larger amount of developers write funny tests just to pass the code coverage bar, and some developers with ambition are not quite sure about how to write good unit tests. Most good UT are written by top developers.

I thought I am that kind of ambitious developer, so I spend two weekends to start to learn it. Most cases listed below are originated from or revised from the book “Practical Unit Testing with Testng and Mockito” by Tomek Kaczanowski. A really good book worth reading.


Concepts

Before we start, let’s visit the concepts of SUT and DOC.

Read More

Share

Linear Algebra in Room Escape

Last weekend I went to play a reality room escape game with some friends. It’s a lot of fun and we finally escape on time!

The only thing make it less perfect is that we skip a “very hard” puzzle according to the staff in the room. We spend 1O minutes on it and we could not found an effective way to solve it.

The game is consisted of a board with 5 rows * 5 columns = 25 lights. Each light is either on or off. Player could switch any light on/off, but switching any light will also switch it’s neighbour on up/down/left/right position at the same time. The goal of this game is for a given status, try to switch some of the lights to make all the lights on.

You could also refer to this graph for the “switch logic”.

Light out example

To win the game, For example, if the initial status looks like the following board (O mean an enlighted light and X mean an off light), then we could switch 2 lights on (2,1) and (4,3) to make all the light on. But is there an systematic way to get a solution?

Read More

Share