Web服务器内存泄漏问题 [英] web server memory leak issue
问题描述
我正在使用 symfony 1.4 创建一个约会网站(这是我使用 symfony 的第一个项目).问题是如果只有 10 个或更少的用户在线,服务器就会冻结.我尝试使用 yslow 优化我的 js、css、精灵我得到了 A 级,但问题仍然存在.这就是为什么我认为我构建应用程序的方式可能是错误的,所以这里是网站 naijaconnexion.com 我向你寻求建议和要做的事情,所以我克服了这个问题
i'm create a dating website using symfony 1.4 (it's my first project using symfony). the problem is there server freezes if there is only 10 or less users online. i tryied optimizing my js, css, sprites using yslow i got grade A but still the problem is always there. that's why i think the way i build the application might be wrong so here is the website naijaconnexion.com i'm asking u for advices and things to do so i overcome this problem
如果我不够清楚就问,如果您想要 cpanel 管理员访问权限,我会发布
If i wasn't clear enough just ask, if you want cpanel admin access i'll post it
我真的很需要你的帮助
例如我在我的主页操作上有这个代码它看起来没问题还是需要优化以及如何
for instance i have this code on my home page action does it seems ok or it needs to be optimized and how
$this->me = $this->getUser()->getGuardUser()->getPerson();
$this->cities = Doctrine_Core::getTable('City')->findByDql("zipcode=''");
$this->countries = Doctrine_Core::getTable('City')->findByDql("zipcode='10'");
$this->contacts = $this->me->getContacts();
$this->favorites = $this->me->getFavorites();
$this->matches = $this->me->getMatches();
$this->pager = new sfDoctrinePager('Conversation', sfConfig::get('app_home_conversations_per_page'));
$this->pager->setQuery($this->me->getConversationsQuery());
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
没有 HYDRATE_ARRAY我可以做到这一点
without HYDRATE_ARRAY i can do this
如果我使用 HYDRATE_ARRAY我能做这样的事情吗 $this->contacts[0]['username'];
if i use HYDRATE_ARRAY will i be able to do stuff like $this->contacts[0]['username'];
请帮忙
推荐答案
问题是学说...
尝试以数组的形式获取所需的值并设置限制!
Try to fetch the needed values as array and set a limit!
以下查询返回了多少个对象:
How many objects are returned by the following queries:
$this->cities = Doctrine_Core::getTable('City')->findByDql("zipcode=''");
$this->countries = Doctrine_Core::getTable('City')->findByDql("zipcode='10'");
$this->contacts = $this->me->getContacts();
$this->favorites = $this->me->getFavorites();
$this->matches = $this->me->getMatches();
?不要忘记它们是引用其他对象的对象!
? Do not forget that they are object with references to other objects!
是的,这会起作用$this->contacts[0]['username'];
.
如果您使用学说查询连接表,您也可以访问相关实体 - 无需执行其他查询.
if you join the tables with the doctrine query, you can access related entities too - without executing additional queries.
$this->contacts = Doctrine_Core::getTable('Contact')
->createQuery('c')
->leftJoin('c.Users u')
->addWhere('...')
->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
$this->contacts[0]['Users'][0]['username']
这篇关于Web服务器内存泄漏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!