知名公司架构资料整理(持续)

1.知乎

主要语言栈: Python Java
演讲:
http://www.infoq.com/cn/news/2014/12/zhihu-architecture-evolution

2.饿了么

主要语言栈: Python Java Go
演讲:

  1. 2017 gopher上海meetup
    开源项目:
  2. Python: thrift-py RPC轮子

3.Bilibili

开源项目:

  1. goim

4. Teambition

主要语言栈: node.js Go

演讲:

  1. 2017 gopher上海meetup

开源项目:

  1. Go: Gear HTTP框架

5. Klook

主要语言栈: Go

6. PingCAP

主要语言栈: GO

开源项目:

  1. Go: TiDB 数据库
  2. Go: log 日志工具

https://github.com/davideuler/architecture.of.internet-product

分享到 评论

Mysql 连接池问题

最近应用日志里发现了mysql偶尔会出现问题

[mysql] 2017/04/26 10:01:05 packets.go:130: write tcp 127.0.0.1:56346->127.0.0.1:3306: write: broken pipe
[mysql] 2017/04/26 10:01:05 packets.go:130: write tcp 127.0.0.1:56346->127.0.0.1:3306: write: broken pipe
[mysql] 2017/04/26 10:01:05 packets.go:130: write tcp 127.0.0.1:56350->127.0.0.1:3306: write: broken pipe
[mysql] 2017/04/26 10:01:05 packets.go:130: write tcp 127.0.0.1:56350->127.0.0.1:3306: write: broken pipe

找GitHub issues, 提到了和mysql的wait_timeout变量有关系, https://github.com/go-sql-driver/mysql/issues/446, 于是找MySQL文档https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#idm140549060476496.

相关说明如下:
The number of seconds the server waits for activity on a noninteractive connection before closing it.
On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()). See also interactive_timeout.

默认是28800s, 8小时.

mysql> show variables like '%wait_timeout%';
+--------------------------+----------+
| Variable_name | Value |
+--------------------------+----------+
| innodb_lock_wait_timeout | 50 |
| lock_wait_timeout | 31536000 |
| wait_timeout | 28800 |
+--------------------------+----------+
3 rows in set (0.00 sec)

解决办法:

db.SetConnMaxLifetime(time.Hour*7)

分享到 评论