Your SlideShare is downloading. ×
0
Island arch
Island arch
Island arch
Island arch
Island arch
Island arch
Island arch
Island arch
Island arch
Island arch
Island arch
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Island arch

1,453

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,453
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 海岛架构和PHP编码规范<br /><ul><li>海岛架构
  • 2. PHP编码规范</li></ul>FarYang<hhy@redekuai.com, faryang@faryang.net><br />PHP技术交流<br />
  • 3. 一、海岛后端介绍<br /><ul><li>Linux + Nginx + MySQL + TokyoTyrant+ PHP5 + redis/memcached?
  • 4. 协议:AMF</li></ul>——Action Message Format<br />海岛具体实现优点:容短暂宕机<br /><ul><li>PHP5(fastcgi/phpfpm)</li></ul>——基于AMFPHP,使用Zend Framework组件,gettext国际化<br /><ul><li>MySQL</li></ul>——InnoDB, (todo: Master/Slave)<br /><ul><li>TokyoTyrant(放弃)</li></ul>——(todo:backup, Master/Slave)<br /><ul><li>Nginx</li></li></ul><li>Web程序“架构”图<br />amf<br />一台服务器谈系统架构?=>Web(程序设计)架构<br />
  • 5. PHP代码目录结构<br />Platform entry<br />Game entry<br />Entrances<br />
  • 6. 海岛后端<br /><ul><li>A. 社区交互部分
  • 7. B. 游戏交互部分
  • 8. /player_id => 拆分
  • 9. 会话,单点登录,异常处理,supersid,在线管理员(role=admin)
  • 10. 国际化,在线debug,
  • 11. C. 配置
  • 12. config.xml <(规范) config-dist.xml
  • 13. 4399.xml < 4399-dist.xml
  • 14. flash.xml < flash-dist.xml
  • 15. Debug options, supersid(本地测试) – Online debug
  • 16. 部署
  • 17. bin:备份所有相关shell脚本
  • 18. 配置项(php.ini, my.cnf,nginx.conf,crontab, init.d/service,sync)
  • 19. D. 工具</li></li></ul><li>WebService简介<br />Flex Client<br />Amfprotocol<br />AmfServer<br />Persist<br />
  • 20. MySQL/NoSQL<br />命名 gm_, vo_, stat_<br />字段小写,下划线<br />数据一致性,可追溯<br />外键,_delete<br />扩展(<-models)<br />每个表_.player_id => 拆分<br />表级别水平拆分:gm_players (player_id,level,gold)=> tt.players<br />非核心业务存储拆分(Memcached/Redis)<br />备份<br />Master/Slave<br />分析<br />重启?=> 每秒query660->330,还会重现?<br />此 MySQL服务器已经运行了 1 天 19 小时,33 分 4 秒,启动时间为 2010 年 06 月 28 日 14:45。<br />Stat=>方案 => buildings,decorations…转移到 Redis(MySQL只做备份用)?<br />
  • 21.
  • 22. 二、PHP编码规范<br />目标/Zend FrameworkCoding Standard<br />http://framework.zend.com/manual/zh/coding-standard.html<br />编码标准对任何开发项目都很重要,特别是很多开发者在同一项目上工作。编码标准帮助确保代码的高质量、少 bug 和容易维护。<br />做法<br />智能提示,语法错误,error, warning<br />运行-正确-(再优化)<br />重构<br />低层次:提炼方法(100rows?),提炼接口(CronInterface),提炼超类(AbstractController),上移方法(_getFarm),重命名(rename)<br />高层次:多态替换条件语句(策略dp),委托替换继承?<br />
  • 23. CODEREVIEW?<br />代码完整性<br />一致性<br />正确性<br />可修改性<br />可预测性<br />健壮<br />http://www.cnblogs.com/xugang/archive/2007/11/14/959125.html<br />SVN STANDARD, 单元测试,PM…?<br />
  • 24. ?<br />

×