php实现websocket手游架构设想

众所周知 php 的开发效率确实块。但在 socket 这块一直没有什么大的发展,设想用 两种方案用 php 实现 websocket game 开发 方案1 netty+quercus+php 方案2 Swoole + php 两种方案感觉都可行,quercus 近期更新力度很大,已经解决 mysql 乱码问题。 php 转成 java 测试性能确实不错 Swoole 是近期关注比较多的了,php 原生实现,作者更新速度很快,但缺少实际项目案例。 两种方案选择了 quercus ,感觉应该更稳定一些,实践中,期待项目上线测试效果

2013-12-20 · 1 分钟 · admin

又拍云第二封故障信

关于又拍云12月5日故障的说明‏ 用户发展太快?不里处理速度还是另人满意的。 补偿好像没收到哈。 尊敬的又拍云用户: 我们为12月5日一组作图服务器故障导致部分图片上传失败给您带来的困扰深表抱歉,为避免您对此的担忧,我们向您坦诚这次故障的具体问题,让您了解这次意外的原因。 因又拍云存储平台的数据量急速上涨,云处理集群的压力也快速放大。为提前缓解数据放大带来的压力,提升作图服务器集群性能,12月5日凌晨,又拍云存储更新部署了一批新的作图服务器,并开启了作图服务的CPU亲缘性绑定支持,将服务绑定到了相应的CPU核心上。这个模式在非超线程环境的服务器中运行良好。但在这批开启了超线程支持的服务器上,随着当天下午请求高峰期的到来,逐渐出现不稳定现象,导致上层proxy超时,在该集群造成雪崩效应;由于我们初期对故障的定位偏差,在进行了系统内核降级、作图服务版本回滚等几项措施之后,未能快速缓解处理该问题,直至最后关闭超线程支持。 在新集群出现不稳定时,我们已紧急切换到了备用集群。但由于作图请求的雪崩效应,导致后备集群一直高负载运行,期间调用图片服务集群的图片上传、缩略图处理的不稳定状况持续了一段时间。在新集群关闭超线程支持、并确认状态正常,重新接入系统后,服务逐步恢复。 您信任我们,将您的数据放在了又拍云存储,出现这样的问题,我们非常的不安,也非常的抱歉,一次故障意味着给您带去了巨大的损失,这个损失我们不知该如何弥补,所以我们决定向您补偿一周的流量并延长一个月的存储使用期限。同时我们将对后续服务持续优化以保证更高的稳定性,避免类似意外的再次发生。我们再次恳请您的谅解。感谢您一直以来对又拍云的支持! 杭州纬聚网络有限公司 2013.12.6

2013-12-16 · 1 分钟 · admin

js rsa 使用 openssl 生成公钥私钥

生成私钥 openssl genrsa -out key.pem 得到16进制公钥 openssl rsa -in key.pem -noout -modulus 直接放到js里就可以使用了

2013-12-12 · 1 分钟 · admin

给又拍云用户的一封致歉信‏

从去年开始用又拍云,收到的第一封故障信,总的来说,还是不错的,如果能像七牛一样,后付费就更好了 亲爱的又拍云存储用户: 2013年11月26日12时,又拍云监控系统报警,提示一部分新数据未能通过API接口上传。技术人员迅速排查,发现一台用于业务数据存储的MySQL服务器异常退出。技术人员当即启动应急预案,将这部分服务切换到灾备数据库,并进行了数据同步,至13时左右服务恢复正常。 服务恢复后,经过全面复检确认:该问题原因是又拍云的数据量级近期暴增,触发了MySQL Bug #63815 Reorganization May Make a Page Incompressible (http://bugs.mysql.com/bug.php?id=63815),导致MySQL数据分块损坏,无法启动服务。现已对主库的数据进行了恢复和校验,并于27日凌晨已完成数据切换。 我们为未能及时做好此问题的防范,给一部分用户带来了影响,在此表示万分的抱歉。我们已于27日上午开始进行数据库的升级准备工作,并将尽快部署完成。在万分抱歉的同时,我们希望此问题不至于给您带来过多的困扰。云存储的发展始终伴随着承载更高数据的挑战,在这一挑战过程中必定伴随着一些没有经历大数据存储就很难知悉的问题。恳请大家相信,又拍云团队在8年的发展和磨练中,具备了对未知情况最大可能的预见能力和在最短时间内解决问题的能力。这次问题对于我们是一个深刻的教训,又拍云将着手进行持续的大数据的模拟,确保在更大数据量来临前,我们为大家做好了最安全的防范措施。 同时,也请这个故障时间段内未出现上传故障、未受到影响的各位用户放心,所有用户的数据外部访问和老数据的存储都未受影响,您的服务在此期间确保正常。如对上述情况有疑问,请您立即联系我们进行沟通,我们将竭尽全力协助您获得满意的结果。 最后,再一次向受此故障影响的各位支持又拍云的朋友们表示万分的歉意。

2013-12-11 · 1 分钟 · admin

cocos2d-x jsb 绑定 ClippingNode

JSClass *jsb_ClippingNode_class; JSObject *jsb_ClippingNode_prototype; JSBool js_cocos2dx_ClippingNode_isInverted(JSContext *cx, uint32_t argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::CCClippingNode* cobj = (cocos2d::CCClippingNode *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 0) { bool ret = cobj->isInverted(); jsval jsret; jsret = BOOLEAN_TO_JSVAL(ret); JS_SET_RVAL(cx, vp, jsret); return JS_TRUE; } JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0); return JS_FALSE; } JSBool js_cocos2dx_ClippingNode_visit(JSContext *cx, uint32_t argc, jsval *vp) { JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::CCClippingNode* cobj = (cocos2d::CCClippingNode *)(proxy ?...

2013-12-10 · 6 分钟 · admin

cocos2d-x jsb 绑定 removeAllDelegates

html5版为 cc.Director.getInstance().getTouchDispatcher().removeAllDelegates(); 但 jsb 下没有,绑定一下。 void JSTouchDelegate::removeAllDelegates() { CCDirector* pDirector = CCDirector::sharedDirector(); pDirector->getTouchDispatcher()->removeAllDelegates(); } JSBool js_cocos2dx_JSTouchDelegate_removeAllDelegates(JSContext *cx, uint32_t argc, jsval *vp) { if (argc == 0) { JSTouchDelegate *touch = new JSTouchDelegate(); touch->autorelease(); touch->removeAllDelegates(); return JS_TRUE; } JS_ReportError(cx, "wrong number of arguments"); return JS_FALSE; } JS_DefineFunction(cx, ns, "removeAllDelegates", js_cocos2dx_JSTouchDelegate_removeAllDelegates, 1, JSPROP_READONLY | JSPROP_PERMANENT);

2013-12-10 · 1 分钟 · admin

阿里云(aliyun)青岛节点挂载硬盘io测试

杭州节点已经停售了,在青岛订购了一台,贴上测试结果。 fdisk -l Disk /dev/xvda: 21.5 GB, 21474754560 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00090497 Device Boot Start End Blocks Id System /dev/xvda1 * 1 2611 20969472 83 Linux Disk /dev/xvdb: 53.7 GB, 53687091200 bytes 255 heads, 63 sectors/track, 6527 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/xvdb doesn't contain a valid partition table 分区...

2013-12-06 · 3 分钟 · admin

debian 下安装 lxc

本文安装环境 debian 6.0 安装 lxc debootstrap 工具 aptitude install lxc bridge-utils debootstrap 设置网络 auto eth1 iface eth1 inet manual auto br0 iface br0 inet static bridge_ports eth1 #根据自己实际网卡设置 bridge_fd 0 address 10.0.0.100 netmask 255.255.255.0 gateway 10.100.0.1 dns-nameservers 10.20.0.2 加载 cgroup 编辑 /etc/fstab cgroup /sys/fs/cgroup cgroup defaults 0 0 立即加载 mount /sys/fs/cgroup 接下来创建一下虚拟机 #下载 squeeze 64位 debootstrap --verbose --variant=minbase --arch=amd64 --include ifupdown,locales,libui-dialog-perl,\ dialog,netbase,net-tools,iproute,openssh-server,vim,apt-utils,proxychains \ squeeze /var/cache/lxc/debian/rootfs-amd64 http://mirrors.163.com/debian/ mkdir -p /lxc/vm0 #存放目录 /usr/lib/lxc/templates/lxc-debian -p /lxc/vm0/ # 创建虚拟机 配置虚拟机网络,在 /lxc/vm0/config 文件填加些文本...

2013-11-23 · 1 分钟 · admin

debian 下 lxc 限制内存出错

起动 vm 的时候出现 lxc-start: open /cgroup/vm0/memory.limit_in_bytes : No such file or directory lxc-start: failed to setup the cgroups for ‘vm0’ lxc-start: failed to setup the container lxc-start: invalid sequence number 1. expected 2 lxc-start: failed to spawn ‘vm0’ 在 /etc/default/grub 文件填加 GRUB_CMDLINE_LINUX="cgroup_enable=memory" 0# lxc-checkconfig Kernel config /proc/config.gz not found, looking in other places... Found kernel config file /boot/config-2.6.32-5-amd64 --- Namespaces --- Namespaces: enabled Utsname namespace: enabled Ipc namespace: enabled Pid namespace: enabled User namespace: enabled Network namespace: enabled Multiple /dev/pts instances: enabled --- Control groups --- Cgroup: enabled Cgroup namespace: enabled Cgroup device: enabled Cgroup sched: enabled Cgroup cpu account: enabled Cgroup memory controller: missing Cgroup cpuset: enabled --- Misc --- Veth pair device: enabled Macvlan: enabled Vlan: enabled File capabilities: enabled

2013-11-23 · 1 分钟 · admin

debian bridge 网卡参数说明

bridge_fd is the bridge forward delay time, in seconds, default 15. bridge_hello is the bridge hello time, in seconds, default 2. bridge_maxage is the bridge’s maximum message time, in seconds, default is 20. bridge_stp controls the spanning tree protocol, on or off. Default is off, and is recommended to stay that way.

2013-11-23 · 1 分钟 · admin

lxc guest 报错 respawning too disabled minutes

INIT: Id "c1" respawning too fast: disabled for 5 minutes INIT: Id "c4" respawning too fast: disabled for 5 minutes INIT: Id "c1" respawning too fast: disabled for 5 minutes INIT: Id "c2" respawning too fast: disabled for 5 minutes INIT: Id "c3" respawning too fast: disabled for 5 minutes INIT: Id "c4" respawning too fast: disabled for 5 minutes INIT: Id "c1" respawning too fast: disabled for 5 minutes INIT: Id "c2" respawning too fast: disabled for 5 minutes INIT: Id "c3" respawning too fast: disabled for 5 minutes INIT: Id "c4" respawning too fast: disabled for 5 minutes 解决方法 编辑 /etc/inittab...

2013-11-23 · 1 分钟 · admin

mysql 5.5 半同步停止工作

两台 mysql 5.5 服务器互为主从,使且半同步模式,网络终断后,但是 同步未能恢复 mysql> show status like 'Rpl_%'; +--------------------------------------------+-------------+ | Variable_name | Value | +--------------------------------------------+-------------+ | Rpl_semi_sync_master_clients | 0 | | Rpl_semi_sync_master_net_avg_wait_time | 213 | | Rpl_semi_sync_master_net_wait_time | 51387187879 | | Rpl_semi_sync_master_net_waits | 240543674 | | Rpl_semi_sync_master_no_times | 2 | | Rpl_semi_sync_master_no_tx | 6402 | | Rpl_semi_sync_master_status | OFF | | Rpl_semi_sync_master_timefunc_failures | 0 | | Rpl_semi_sync_master_tx_avg_wait_time | 276 | | Rpl_semi_sync_master_tx_wait_time | 68522585281 | | Rpl_semi_sync_master_tx_waits | 248230976 | | Rpl_semi_sync_master_wait_pos_backtraverse | 1101735 | | Rpl_semi_sync_master_wait_sessions | 0 | | Rpl_semi_sync_master_yes_tx | 240799932 | | Rpl_semi_sync_slave_status | ON | | Rpl_status | AUTH_MASTER | +--------------------------------------------+-------------+ 恢复操作...

2013-11-22 · 1 分钟 · admin

cocos2d-x 2.1.5 jsb 读取 plist

static JSBool js_cocos2dx_CCFileUtils_createDictionaryWithContentsOfFile(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSBool ok = JS_TRUE; JSObject *obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::CCFileUtils* cobj = (cocos2d::CCFileUtils *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { std::string arg0; ok &= jsval_to_std_string(cx, argv[0], &arg0;); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cocos2d::CCDictionary* ret = CCDictionary::createWithContentsOfFile(arg0.c_str()); jsval jsret; jsret = ccdictionary_to_jsval(cx, ret); JS_SET_RVAL(cx, vp, jsret); return JS_TRUE; } JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); return JS_FALSE; }

2013-10-17 · 1 分钟 · admin

cocos2d-x 2.1.5 clippingNode在 jsb 下无效的修改

**http://cocos2d-x.org/boards/6/topics/20141?r=20567#message-20567 ** for iOS: in AppController replace the gl-view creation with: EAGLView *__glView = [EAGLView viewWithFrame: [window bounds] pixelFormat: kEAGLColorFormatRGBA8 depthFormat: GL_DEPTH24_STENCIL8_OES preserveBackbuffer: NO sharegroup: nil multiSampling: NO numberOfSamples: 0]; for Android: in game activity: public Cocos2dxGLSurfaceView onCreateView() { Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8); return glSurfaceView; }

2013-09-23 · 1 分钟 · admin

bae联通节点更新ip,广州长宽终于正常了

bae 联通节点之前一直用的是 63开头的ip,长城宽带一直打不开。。有时 hao123 都打不开。。 ,今天打开 blog 一下就开了。。发现联通节点变成了 202.108.23.200 速度还真不错,不知道是不是前几天我在群里反应长城宽带打不开网站就调整了哈。

2013-09-16 · 1 分钟 · admin