symfony 1.4中的性能问题

时间:2022-10-25 19:11:06

I have a web application that is built on symfony 1.4 framework. I'm making nearly 10 DB calls per http request. I found that to process the request, it takes nearly 600-800ms on the server itself. When I put log statements to track the time spent in making DB calls, I found that it is less than 20% of total time. I then found that most of the time is being spent on converting the db resultset to PHP objects. The time taken for a select query is of the order of tens of ms but time spent in deserializing this resultset is around 8-9 times more. Any suggestions on how to optimize this?

我有一个基于symfony 1.4框架的Web应用程序。我正在为每个http请求进行近10个DB调用。我发现要处理请求,服务器本身需要近600-800毫秒。当我将日志语句用于跟踪进行数据库调用所花费的时间时,我发现它不到总时间的20%。然后我发现大部分时间都花在将db结果集转换为PHP对象上。 select查询所花费的时间大约为几十ms,但是反序列化此结果集所花费的时间大约是8-9倍。关于如何优化这个的任何建议?

As of now I can think of adding APC so that interpreting entire php code for every request can be avoided. I also found from few links that autoloading for every request in symfony causes slowness. Any other ways of optimizing?

到目前为止,我可以考虑添加APC,以便可以避免为每个请求解释整个PHP代码。我还从几个链接中发现,symfony中每个请求的自动加载都会导致缓慢。还有其他任何优化方式吗?

1 个解决方案

#1


0  

According to the Doctrine documentation (assuming you are using Doctrine) hydrating to objects is more impactful on performance than hydrating to arrays. Unless you need to use business logic or modify the DB records then I've found you get a significant improvement using hydrate array.

根据Doctrine文档(假设您正在使用Doctrine),对物体的保湿对性能的影响比对阵列的保湿更有影响。除非您需要使用业务逻辑或修改数据库记录,否则我发现使用水合物阵列可以获得显着的改进。

#1


0  

According to the Doctrine documentation (assuming you are using Doctrine) hydrating to objects is more impactful on performance than hydrating to arrays. Unless you need to use business logic or modify the DB records then I've found you get a significant improvement using hydrate array.

根据Doctrine文档(假设您正在使用Doctrine),对物体的保湿对性能的影响比对阵列的保湿更有影响。除非您需要使用业务逻辑或修改数据库记录,否则我发现使用水合物阵列可以获得显着的改进。