打印

Ruby的session伸缩方案

Ruby的session伸缩方案

原文: HowtoSetupDistributedphp?name=Ruby" onclick="tagshow(event)" class="t_tag">Ruby
译者:g.zhen.ning a.k.a cclong
校对 drive2me


Scott Barron写了一篇非常棒的文章,文章名为” Session Container Performance in Ruby on Rails”。
这篇文章描述了使用不同类型存储机制管理session的性能问题,包括:
No Sessions
Memory Store (RAM)
DRb Store
PStore (默认,存放于/tmp文件夹下)
ActiveRecord Store (MySQL or PostgreSQL)

如果你想使用distributed ruby设立Ruby on Rails,首先到命令行下输入:

locate drb_server.rb


然后,使用全路径到drb_server.rb,输入

ruby /path/to/drb_server.rb &


这设立了运行于后台的分布式ruby服务器,this must be running for DRb to work。

下一步,如果你使用mod_ruby或cgi,请改变你的分发器(dispatcher),把下面的
引用:
Dispatcher.dispatch
改为
引用:
Dispatcher.dispatch CGI.new, {'database_manager' => CGI::Session:RbStore}
引用:
Dispatch.fcgi
,改它为
引用:
FCGI.each_cgi { |cgi| Dispatcher.dispatch(cgi, {'database_manager' => CGI::Session:RbStore},
File.dirname(__FILE__) + "/500.html") }
为了此改动生效,请记得重新启动你的apache服务器。

就这样完成了!你的sessions现在将由DRb管理。不但伸缩性要比默认的PStore要好,就算在一般情况下处理速度也快点,而且你现在可以多种不同的web服务器共同处理相同的分布的session,因此Ruby on Rails伸缩性能大增。
本帖最近评分记录
  • drive2me R币 +10 奖励! 2008-5-15 00:25

TOP

谢谢cclong,现在就你一个在翻译了,在坚持。
好样的!
Flying Piggy...! 
天地人合一!

TOP

他不是一个人战斗,他不是一个人!

在官方授权的RoRcn的wiki里有许多人在一起翻译着RoRwiki的内容,也增加了许多国人自己写的RoR技术文章:
http://wiki.rubyonrailscn.org/rails/show/HomePage

cc同学可以把文章贴到这里来让更多人看到你翻译的成果。
###
blog => red_world,
mail => [image]http://services.nexodyne.com/email/icon/NTbKP7EQRA%3D%3D/c2n6Sgw%3D/R01haWw%3D/0/image.png[/image]
###

TOP

有我们的人在那边翻译吗?
怎么加到那里去,你说明一下呀?

还有这里的中文化组,你们想怎么干?
组员都去哪里了,都在忙啥?
Flying Piggy...! 
天地人合一!

TOP

Ruby on Rails Wiki provides us a pretty good environment and standard resource. Installation is important for most of new users, there is no doubt we will do that first. However, We might put more time Main Topics, such as Development, and they are more interesting and help RoRers can get more benefits from there.

I might move to Main Topics after finishing my current translations. Ajax&Javascript, Logging, patterns, they are all very good topics.

TOP

引用:
原帖由 xinhao 于 2008-5-21 02:03 发表
Ruby on Rails Wiki provides us a pretty good environment and standard resource. Installation is important for most of new users, there is no doubt we will do that first. However, We might put more tim ...
好的,赞成你的想法。你和cclong一起干吧。
Flying Piggy...! 
天地人合一!

TOP

2008-12-04 06:16 Crawled by CCBot/1.0 (+http://www.commoncrawl.org/bot.html) @38.103.63.57