Skip to content

Instantly share code, notes, and snippets.

View fedwatch's full-sized avatar

fed fedwatch

  • Jaayan
  • Shanghai , China
View GitHub Profile
@fedwatch
fedwatch / controllers.application.js
Last active September 4, 2017 15:43
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/otn/resources/css/validation.css" rel="stylesheet" />
<link href="/otn/resources/merged/common_css.css?cssVersion=1.8967" rel="stylesheet" />
<link rel="icon" href="/otn/resources/images/ots/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/otn/resources/images/ots/favicon.ico" type="image/x-icon" />
<script>
/*<![CDATA[*/
var ctx='/otn/';
@fedwatch
fedwatch / gist:a9ffaf32038b11ce91967692a203c665
Created December 27, 2016 09:19
秒杀系统架构优化思路
本文曾在“架构师之路”上发布过,近期支援Qcon-AS大会,在微信群里分享了该话题,故对原文进行重新整理与发布。
一、秒杀业务为什么难做
1)im系统,例如qq或者微博,每个人都读自己的数据(好友列表、群列表、个人信息);
2)微博系统,每个人读你关注的人的数据,一个人读多个人的数据;
3)秒杀系统,库存只有一份,所有人会在集中的时间读和写这些数据,多个人读一个数据。
例如:小米手机每周二的秒杀,可能手机只有1万部,但瞬时进入的流量可能是几百几千万。
又例如:12306抢票,票是有限的,库存一份,瞬时流量非常多,都读相同的库存。读写冲突,锁非常严重,这是秒杀业务难的地方。那我们怎么优化秒杀业务的架构呢?
@fedwatch
fedwatch / index.html
Created December 27, 2016 09:19
12306页面代码1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/otn/resources/css/validation.css" rel="stylesheet" />
<link href="/otn/resources/merged/common_css.css?cssVersion=1.8967" rel="stylesheet" />
<link rel="icon" href="/otn/resources/images/ots/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/otn/resources/images/ots/favicon.ico" type="image/x-icon" />
<script>
/*<![CDATA[*/
var ctx='/otn/';