是用Apache::DBI模块。
参考这个:
http://perl.apache.org/docs/1.0/guide/performance.html#Modules_Initializing_at_Server_Startup
--
http://twitter.com/smallfish9
http://chenxiaoyu.org/blog


在 2010年5月4日 上午11:11,smallfish <[email protected]>写道:

> 嗯,写在startup里,但是不需要定时ping。
> 你可以查看官方文档,有连接池的说明。
> 只需要startup里起一个连接,你的其他程序只需要跟这个名字一样就会利用上连接池了。
>
> --
> http://twitter.com/smallfish9
> http://chenxiaoyu.org/blog
>
>
> 在 2010年5月4日 上午11:04,万朝伟 <[email protected]>写道:
>
>  朋友,你的这段代码是怎么写的,贴出来我学习一下,以前我做测试的时候在mysql的日志里面每次请求后都看到连接断开
>>
>>
>>
>> 你是写在startup.pl里面,然后用alarm定时去ping数据库?
>>
>>
>>
>> *发件人:* [email protected] [mailto:[email protected]] *代表
>> *smallfish
>> *发送时间:* 2010年5月4日 10:47
>> *收件人:* [email protected]
>> *主题:* Re: 答复: [PerlChina] FCGI vs MODPERL, which is faster on Apache?
>>
>>
>>
>> 呵呵,modperl有连接池的,只要在初始化时候定义一个dbh,然后程序里名字跟他一样就可以了。
>>
>> --
>> http://twitter.com/smallfish9
>> http://chenxiaoyu.org/blog
>>
>>  在 2010年5月4日 上午10:44,万朝伟 <[email protected]>写道:
>>
>> 在apache2.0刚出来的时候我做过测试,普通脚本性能差异不大,如果有数据库连接的
>> 话fastcgi可以实现连接池,modperl不能实现,有数据库连接的情况下fastcgi小胜
>> modperl。从2007年开始我改行写php了,php的执行效率在两者之上。
>>
>> 这年头如果一台服务器还跑不动说明了两个问题:
>> 1. 程序够烂,可以换程序员了
>> 2. 你的程序/公司足够牛逼,绝对有钱使用更多和更好的服务器
>>
>> -----邮件原件-----
>> 发件人: [email protected] [mailto:[email protected]] 代表
>> Beckheng Lam
>> 发送时间: 2010年5月4日 9:28
>> 收件人: [email protected]
>> 主题: [PerlChina] FCGI vs MODPERL, which is faster on Apache?
>>
>>
>> 大家好,
>>    我看到一些文章提到,FASTCGI比起MODPERL性能要高,而且带有测试结果的。
>> 所以想确认一下。同样是PERL写的WEB软件( 不涉及于直接使用MODPERL相关的API
>> ),是使用FCGI还是MODPERL性能更高?似乎这样变得只是限于FCGI及modperl::
>> registry?
>>    请各位发表下,谢谢!
>>
>> --
>> Perl乐事 -- http://www.perlersh.org
>> 我的博客 -- http://www.perlersh.org/blog.html
>> 诸法从缘起,如来说是因。
>> 彼法因缘尽,是大沙门说。
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论
>> 坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问
>> 此网上论坛。
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>>
>>
>> --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>>   --
>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
>> 要取消订阅此网上论坛,请发送电子邮件至 
>> [email protected]<perlchina%[email protected]>
>> 。
>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>>
>
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复