`
nightsailer
  • 浏览: 24370 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
最近Node.js 很火, 我对此很有兴趣,因为之前我自己也在使用Perl的AnyEvent。   Event/IO的一个要点是non-blocking。 Nginx能够解决c10k的问题,一个关键是使用 Event Loop取代传统的thread/pre-fork。要想充分发挥nginx的优势,需要后端和对应 模块都能够non-blocking才行。   然而,现实多数的架构都是blocking的,比如PHP/FastCGI, 即便nginx的前端再好,后端的应用依然是瓶颈。 所以,如何使用Event/IO实现non-blocking编程,是我们要关注的一个领域。 ...
简要说一下MongoDB的备份方式: 1. mogodump / mongorestore 这2命令将mongodb的数据dump为BSON格式,需要的时候可以恢复。这种方式作为小的数据库还适用。但如果是sharding或者几百G数据以上的话就几乎不可用了。因为BSON及其占用空间。 2. Slave Replication   这是最适合和可靠的,适合生产环境。MongoDb支持master+多个slave。因此可以很方便的起一个slave来进行备份。但是需要注意的是如果数据量很大的话,如果是新建的slave,速度又没有保证的话,一定要调高 oplogSize 的大小,对于一个300 ...
在MongoDB 从1.1.x版本开始可以将server side code存储,这样可以一次性导入或者存储函数定义后, 就可以在$where等中使用这些函数. 在PHP driver中如何存储和定义这些js 函数? 目前似乎没有直接的简单方法. 如果调用MongoDb::execute是不行的. 我的解决方法使用曲线救国,通过将代码save到system.js进行存储,通过execute js closure来调用. 例子如下: public function store_server_function($fun_name,$fun_body) { $code ...
Perl下面向mongodb插入中文字符串会出现乱码. 根据MongoDB的文档, MongoDB支持UTF-8的编码. 但在Perl中, 如果直接使用utf8的字符串,也会出现问题. 测试代码: my $mongo_dbh = $mongo_connection->get_database( $mongo_db ); my $t = $mongo_dbh->get_collection(’test’); my $word = ‘测试’; $t->insert({ title => $word }); my $row = $t->find_one ...
在mac osx 10.6.2(snow leopard)编译gmagick失败. 错误如下: ld: duplicate symbol _php_gmagick_sc_entry in .libs/gmagick_methods.o and .libs/gmagick_helpers.o collect2: ld returned 1 exit status make: *** [gmagick.la] Error 1 感觉很奇怪,因为在centos上没问题. 检查了下gmagick_methods.c和gmagic_helpers.c 也没有重复定义啊. $ nm .libs/gm ...
发现PHP imagick or magickwand无法正确加载. 经过测试发现是由于和gmagick冲突. 解决, 在编译GraphicsMagick时候加入: –enable-symbol-prefix 重新编译后正常.
从5.2.6升级到5.2.11后PATH_INFO突然无法使用了(no input file). 不知道是谁的问题. 解决: 必须使用NGINX的fastcgi_split_path_info. location ~ .*\.php(.*)$ { fastcgi_split_path_info ^(.+\.php)(.*)$; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; } 之前,以下配置是能工作的(设置php.ini=>cgi.fix_pathinf ...
从5.2.6升级到5.2.11后PATH_INFO突然无法使用了(no input file). 不知道是谁的问题(新的php-fpm导致). 解决: 必须使用NGINX的fastcgi_split_path_info. location ~ .*\.php(.*)$ { fastcgi_split_path_info ^(.+\.php)(.*)$; include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; } 之前,以下配置是能工作的(设置php.ini=>cgi. ...
GraphicsMagick(GM)是ImageMagick(IM)的可替代的图片处理 方案,但是, GraphicsMagick比ImageMagick具有性能高,稳定的优点. 而且, IM能实现的,GM都可以做到. IM的最大问题就是代码变动太大,不够稳定. GM相对而言要稳定对了, 此外体积也没有GM那么臃肿. Flickr 从2004年后就放弃了ImageMagick而使用GraphicsMagick, 可谓GM最佳的成功案例. GraphicsMagick性能提升的一个亮点就是支持OpenMP, 通过OpenMP的优化,性能提升数倍以上. 虽然IM也能够支持OpenMP,但即 ...
生产环境跑的是打了google mysql-patch v4的mysql, 运行效果一直不错. Percona提供的mysql补丁集也不错, 尤其是增加了很多有用的信息,在运行时分析性能瓶颈很有用. Google的v3/v4补丁相对来说就少了一些. 最新的5.0.97b20出来后,我决定替换slave,目的是希望更方便的分析运行期统计信息. 和google v4一样,我使用了新的icc v11.1.x进行了优化编译. 步骤如下: 1. 编译libunwind CC=icc \ CXX=icpc \ LD=xild \ AR=xiar \ CFLAGS=’-O3 -ipo - ...
系统已安装: 1. tcmalloc (google-perftools-1.4 ) 2. libmemcached v0.35(v0.30+) 编译gearmand-0.10: tar zxvf gearmand-0.10.tar.gz ./compile-gearman.sh =========gearman.sh===== make distclean CC=icc \ CXX=icpc \ CFLAGS=” -O3 -ip -std=gnu99 -no-prec-div -xSSE3 -axSSE4.2,SSE4.1,SSE3 -static-intel -no- ...
系统已安装: 1. tcmalloc (google-perftools-1.4 ) 2. libmemcached v0.35(v0.30+) 编译gearmand-0.10: tar zxvf gearmand-0.10.tar.gz ./compile-gearman.sh =========gearman.sh===== make distclean CC=icc \ CXX=icpc \ CFLAGS=” -O3 -ip -std=gnu99 -no-prec-div -xSSE3 -axSSE4.2,SSE4.1,SSE3 -static-intel -no- ...
1. Mysql(percona branch 5.0.x) * 主数据库 * Master-Master replication( MMM powered) 2. MongoDb * GridFS, 分布式文件存储 * Some models(Logging,Tag, etc.) 3. Flare * cluster * Session storage(persisten memcahed). * Gearmand backend persisten storage. (libmemcached plugin). 4. Gearman * Job server * M ...
MongoDb的Replication支持: 1. master-slave: slave可以有多个. 2. Replica Pairs 实际上是一个failover的master-slave模式. 启动时,2个node的mongo会协商,其中1个成为master,另一个为slave. 当master down了,那么slave会自动接管成为master. 不过,这种模式需要driver支持. 需要在driver connect时候 选择pairs 模式. 3. 有限的master-master 可忽略 问题是,我希望是 replica pairs + slave(s) 模式. ...
打算把生产环境的PHP升级到5.2.11, 于是重新使用ICC编译了PHP-5.2.11+PHP-FPM-0.6. 结果编译时失败,出现以下错误: fpm_atomic.h(116): catastrophic error: #error directive: unsupported architecture. please write a patch and send it in #error unsupported architecture. please write a patch and send it in 开始以为是我使用独立安装造成的,不过尝试了integrat ...
Global site tag (gtag.js) - Google Analytics