博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在symfony2项目中100%提升doctrine的性能
阅读量:6405 次
发布时间:2019-06-23

本文共 1402 字,大约阅读时间需要 4 分钟。

  hot3.png

Doctrine 2 has a devoted to caching but up until now we had never taken a look to it at .

The thing is that the chapter does not only speak about caching SQL results for some time - the result cache -, a type of cache we're currently not interested in, but caching metadata to improve Doctrine performance. The problem is that by default both caching the class metadata and executing the DQL transformation are done in each request, but they could be cached for the duration of your current deploy, so there's room for improvement.

The first cache you should modify is the . The documentation is very clear about it:

It is highly recommended that in a production environment you cache the transformation of a DQL query to its SQL counterpart. It doesn’t make sense to do this parsing multiple times as it doesn’t change unless you alter the DQL query.

The second one is the , that avoids having to parse class metadata coming from annotations, YAMLs or XML in each request.

The way to change these settings in Symfony 2 is simple. Just modify your app configuration (here we're changing from the default value "array" to "apc", but you could also use "memcache", "memcached", "xcache" or "service"):

doctrine:  orm:    metadata_cache_driver: apc    query_cache_driver: apc

The result? We've improved up to 100% the performance of our most DB-intensive pages.

Picture

转载于:https://my.oschina.net/imot/blog/219556

你可能感兴趣的文章
我的友情链接
查看>>
kvm中虚拟机的硬盘扩容
查看>>
Android (Launch Mode) 四种启动模式
查看>>
大数据量数据库的简单备份迁移数据技巧
查看>>
JAVA程序员面试总结,高手整理加强版
查看>>
17-SCVMM2012之虚拟机模板
查看>>
磁盘管理详解(02)
查看>>
Ubuntu通过LDAP集成AD域账号登录(libnss-ldap方式)
查看>>
透视学理论(二)
查看>>
博为峰JavaEE技术文章 ——MyBatis Provider之@SelectProvider
查看>>
zabbix3.2.7之图形集中展示插件Graphtree
查看>>
ubuntu16.04 14.04 安装 vnc server 及eclipse配置
查看>>
gitlab 钩子
查看>>
桌面支持--BAT文件执行注意事项
查看>>
电脑经验--bootmgr is missing解决办法
查看>>
虚拟化--020 vsphere 命令收集
查看>>
docker-swarm容器固定到node节点启动
查看>>
Spread for Windows Forms快速入门(8)---单元格中用户动作触发的事件
查看>>
python学习笔记之读取配置文件
查看>>
【算法】JAVA实现快慢指针法 单链表实现判断水仙花字符串
查看>>