欢迎各位兄弟 发布技术文章
这里的技术是共享的
我们有一个相当高流量的网站150万的页面浏览量一个月。该网站使用的显示各个节点的一个相当标准的面板节点覆盖。左侧获得节点内容如标题,内容主体和节点意见。右侧栏得到一个最新的故事块,广告,以及相关的故事阻塞。其实面板窗格在大多数情况下不会块。我们运行内存缓存和清漆,但我们发现,交通模式总是包括许多非高速缓存的请求和结垢部位向上的意思是尽可能快地提供单一页。
杰韦利输出这一点。
在112.01毫秒执行的208查询。查询超过5毫秒高亮显示。页面执行时间为2039.75毫秒。这太慢
最慢的查询是5.24毫秒这样的查询这里并不是最大的问题。
附件是从XHProf的和调用图的屏幕抓取。
在我看来,这是一个由千割伤死亡。最慢的函数需要165毫秒,但有80个,000函数调用,总的,只是时间太长。
我不知道如何加快这。我需要沟板,观点和所有其他漂亮的Drupal工具和从头确保每个部分是高性能的只是代码这件事?
任何意见是非常赞赏。
谢谢
附件 | 尺寸 |
---|---|
通过挂钟时间EXC XFProf | 174.38 KB |
调用图 | 9.94 MB |
注释
DBLOG
注 - 数据库日志记录是关闭的生产 ( 这个好像速度变快了 ) - 也许可以节省100 milleseconds
登录或注册后发表评论
代理的Acquia与实体缓存?
貌似的Acquia代理模块导致了缓慢的http请求
acquia_agent_get_subscription()
你能做些什么来限制这个模块做的HTTP请求的数量?
您是否尝试过实体缓存?https://drupal.org/project/entitycache
登录或注册后发表评论
我去看看,如果我能得到
我去看看,如果我能得到的Acquia代理模块关闭我认为的Acquia ApacheSolr模块其所需虽然。
我会尽力entitycache太多我不使用它目前。我可能需要使用一个缓存温暖,虽然看到有很大的好处。只要是高性能这将是确定的,但。
登录或注册后发表评论
你虽然同意吗?那里
你虽然同意吗?有几件事情或许,但那些削减1000这看起来像死之外坚定。有运行要快只是太多的代码
登录或注册后发表评论
由1000死亡削减分析
Xdebug的的cachegrind输出时分析wincachegrind试图找到慢点的时候(在葡萄酒的作品)是非常有帮助的。我觉得到KCacheGrind调试不那么用户友好的当谈到找出慢了点。
只是为了检查安装一样APC您使用PHP 5.4或刨丝器具有某种操作码缓存?如果没有,这样做,因为这将有很大的帮助。
登录或注册后发表评论
托管的Acquia
托管的Acquia与5.3.2-1ubuntu4.21 APC
APC的设置:
apc.cache_by_default开开
apc.canonicalize开开
apc.coredump_unmap关关
apc.enable_cli开开
apc.enabled开开
apc.file_md5关关
apc.file_update_protection 2
apc.filters没有价值没有价值
apc.gc_ttl 3600 3600
apc.include_once_override关关
apc.lazy_classes关关
apc.lazy_functions关关
apc.max_file_size 1M 1M
apc.mmap_file_mask的/ dev /零的/ dev / zero的
apc.num_files_hint 1024 1024
apc.preload_path没有价值没有价值
apc.report_autofilter关关
apc.rfc1867关关
apc.rfc1867_freq 0 0
apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
apc.rfc1867_prefix upload_ upload_
apc.rfc1867_ttl 3600 3600
apc.shm_segments 1
apc.shm_size 192 192
apc.stat开开
apc.stat_ctime关关
apc.ttl 7200 7200
apc.use_request_time开开
apc.user_entries_hint 4096 4096
apc.user_ttl 7200 7200
apc.write_lock开开
登录或注册后发表评论
这不是代理的Acquia
这不是代理的Acquia模块本身是缓慢的,但您的网络或服务器的Acquia。独家壁时间是可以忽略不计的各种acquia_agent功能,而且相当高的通话时164.835毫秒在stream_socket_client()打开的连接。
3调用的fread()在135.390ms可以或可以不依赖于响应的文件大小和服务器和的Acquia服务器之间的网络延迟(即距离)的问题。每HTTP请求平均45ms并没有真正看起来那么糟糕。
的HTTP请求,然而,只有占的总执行时间的15%。还有那些有助于缓慢其他的东西。
尝试运行模块定时器模块(https://drupal.org/sandbox/jchin1968/2061005)在你的开发环境。这将突出在页面上呈现缓慢块和甚至呈现在背景,但不显示块。
登录或注册后发表评论
我认为,这是由于
我认为这是由于我的开发环境中运行XHProf的。据推测,在生产这些功能的运行速度将更快,因为与代理的Acquia服务器的距离将大大减少。
我给阻止计时器一试
登录或注册后发表评论
你有面板缓存和
你有面板缓存和视图缓存启用?Memcached的似乎变得甚少。
需要Drupal的帮助?联系我
分享您的文章,网址,网站www.sociopost.com
登录或注册后发表评论
我这种情况下,这是一个节点
我这种情况下,这是一个节点页面。面板缓存是事情是“全球性”活动的。激活它节点内容实在不是那么有帮助。一旦一个页面,一旦它被用清漆10分钟缓存被击中。大部分流量是匿名的。
也许有一个缓存实体缓存回暖将有助于
登录或注册后发表评论
此外,我们不得不动
同样,我们也只好搬到缓存件返还给数据库。内存缓存似乎耗尽内存,如果我们离开整个缓存内存缓存。页面缓存和缓存的看法使用DB缓存。
登录或注册后发表评论
什么是交通高峰期?
150万浏览量/月可能会或可能不会分解成很多并发页面请求/秒。是网站慢所有的时间或仅在高峰负荷?
同时,你有没有验证清漆缓存或确定缺少什么网址?或者你可以增加TTL或使用基于内容缓存(一拉的Acquia吹扫)?
FWIW,除非你有一些超级流量峰值,在正常和正确配置的网站; 我想不久的游客为99.9%只具有快速清漆缓存的经验。
如果该网站是marketplace.org,TTL为600秒。只需点击的时候,我得到了大部分快速响应时间,但命中了一些缓存未命中。我注意到一对夫妇缓存计数200左右,但在10s最为明显降低。我意识到这是一个新闻网站,但如果交通覆盖的URL正态分布 - 我倒是想了不少游客可以缓存未命中B / C 10米的TTL。清漆可以有效地覆盖了主页,并在这里的几个顶部的链接。
劳登&Company公司咨询
登录或注册后发表评论
是啊10分钟TTL似乎
是啊10分钟TTL似乎是最让我可以逃脱出于政治原因而不是技术的贵得多。我可以尝试更长的时间缓存,然后选择结算,但真正的问题是200 +模块和功能分数未绩效建 - 现场需要审核,并在考虑性能显著重建。当前构建更加的地方做的样机,并投掷他们可以在所有模块它,使其工作,外观和行为像模拟了局面。
登录或注册后发表评论
你可以写一个爬虫来验证缓存命中/未命中?
如果你写的击中了你的前100名的URL抓取工具(比如1每3秒每天6次)和存储HEAD,具体为:
的X年龄:
的X缓存点击数:
你就可以告诉你的缓存策略如何有效。我不认为这将是超高难度/耗费时间来写。我可以张贴的东西接近红宝石一个要点...但它可能是不错的劫持一些提振?代码,以便它可以有一个动态的URL列表,而不是静态的。
我不知道你将能够做一大堆提高速度。尝试运行AB或任何基准测试工具,你喜欢对抗,只是自举Drupal的一个文件 - 没有菜单路由,没有渲染,等我想看看更好的缓存策略,但情况因人而异。
干杯
劳登&Company公司咨询
登录或注册后发表评论
其实,我做了一个非常相似的
其实我在做的NodeJS一个非常类似的事情在几个月前。这将加载在头版每隔几个小时,然后打了6顶的故事,都在不同的线程(使用群集模块)。我也记录Apache的统计数据输出统计以及各种服务器指标(负载,内存,网络和磁盘IO,正在运行的进程)。花了不到30分钟写(约半打节点模块感谢),并帮助我追查困扰我几个月的问题。
HollyIT -抓住Netbeans的Drupal的开发工具在GitHub上。
登录或注册后发表评论
选择性清除缓存可以
选择性清除缓存可以走很长的路要走(如果一个新的博客文章是写,只能清除博客首页等)。
然后ESI(边缘端包含)有单个页面的不同部分不同的缓存规则(如“最流行的”块可能并不需要一次一个多小时进行更新,是对每一页相同现场)。
-
戴夫·汉森-兰格
技术经理Advomatic LLC 白色大北方办事处 加拿大
登录或注册后发表评论
ESI资源/提示?
嘿戴夫,
我还没有看到太多的参考使用ESI模块或在野外使用一段时间ESI网站的网站。
我将它设置一个客户端,有巨大的流量需求,但它采取了很多努力,是很难调试。我碰到的问题瓦特/模块的兼容性瓦特/ ESI块,ESI面板和IIRC的背景下,等 - 它已经超过一年在这一点上,所以我不能完全记住所有的细节。这仅仅是一个野兽。
反正我没有看到authcache 2-X是面向对ESI寿,似乎记得听到的Symfony / D8拥有雄厚的ESI支持。所以它看起来像有在地平线上的一些很酷的东西:)
你知道运行Drupal的瓦特/ ESI或任何好的资源,很多网站的?我想追赶上目前的状态 - 我可能需要在一个项目在这里在不久的将来。
谢谢!
Good query execution time but page execution time too high
We have a fairly high traffic site 1.5 million page views a month. The site uses a fairly standard Panels node override for displaying individual nodes. Left side gets node content such as title, content body and node comments. Right sidebar gets a latest stories block, an ad, and related stories block. Actually panels panes in most cases not blocks. We do run memcache and Varnish but we find that the traffic pattern always includes a number of uncached requests and scaling the site up mean delivering a single page as fast as possible.
Devel outputs this.
Executed 208 queries in 112.01 ms. Queries exceeding 5 ms are highlighted. Page execution time was 2039.75 ms. This is too slow
Slowest query is 5.24 ms so queries are not the biggest problem here.
Attached is a screen grab from XHprof and a callgraph.
It seems to me this is death by a thousand cuts. The slowest function takes 165 ms but there are 80, 000 functions called and the total of that just takes too long.
I'm not sure how to speed this up. Do I need to ditch panels, views and all the other nice Drupal tools and just code this up from scratch making sure each part is performant?
Any advice is much appreciated.
Thanks
Comments
Dblog
Note - database logging is off in production - saves maybe 100 milleseconds
Login or register to post comments
Acquia Agent & Entity Cache?
Looks like the acquia agent module is causing the slow http request
acquia_agent_get_subscription()
What can you do to limit the number of http requests this module does?
Have you tried entity cache?
https://drupal.org/project/entitycache
Login or register to post comments
I'll see if I can get the
I'll see if I can get the Acquia Agent module shut off I think its required by Acquia ApacheSolr module though.
I'll try entitycache too I'm not using it currently. I might need to use a cache warmer though to see a lot of benefit. That would be ok though as long as it is performant.
Login or register to post comments
Do you agree though? There
Do you agree though? There are a few things to firm up perhaps but outside of those this seems like death by 1,000 cuts. There is just too much code running to be fast
Login or register to post comments
death by 1,000 cuts analysis
xdebug's cachegrind output when analyzed with wincachegrind (works under wine) can be very helpful when trying to find the slow points. I find KcacheGrind to not be as user friendly when it comes to finding out the slow points.
Just to check are you using php 5.4 or grater with some kind of op code cache like APC installed? If not, do it as it will help a lot.
Login or register to post comments
Acquia hosting
Acquia hosting 5.3.2-1ubuntu4.21 with APC
APC settings:
apc.cache_by_default On On
apc.canonicalize On On
apc.coredump_unmap Off Off
apc.enable_cli On On
apc.enabled On On
apc.file_md5 Off Off
apc.file_update_protection 2 2
apc.filters no value no value
apc.gc_ttl 3600 3600
apc.include_once_override Off Off
apc.lazy_classes Off Off
apc.lazy_functions Off Off
apc.max_file_size 1M 1M
apc.mmap_file_mask /dev/zero /dev/zero
apc.num_files_hint 1024 1024
apc.preload_path no value no value
apc.report_autofilter Off Off
apc.rfc1867 Off Off
apc.rfc1867_freq 0 0
apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
apc.rfc1867_prefix upload_ upload_
apc.rfc1867_ttl 3600 3600
apc.shm_segments 1 1
apc.shm_size 192 192
apc.stat On On
apc.stat_ctime Off Off
apc.ttl 7200 7200
apc.use_request_time On On
apc.user_entries_hint 4096 4096
apc.user_ttl 7200 7200
apc.write_lock On On
Login or register to post comments
It's not the Acquia Agent
It's not the Acquia Agent module itself that is slow but your network or the Acquia server. The Exclusive Wall-Time is negligible for the various acquia_agent functions but quite high for the call to stream_socket_client() at 164.835 ms to open a connection.
The 3 calls to fread() at 135.390ms may or may not be an issue depending on the file size of the response and the network latency (i.e. distance) between your server and the Acquia server. 45ms on average per HTTP request doesn't really seem that bad.
HTTP requests, however, only account for 15% of the total execution time. There's other things that are contributing to the slowness.
Try running the Block Timer module (https://drupal.org/sandbox/jchin1968/2061005) on your development environment. It will highlight slow rendering blocks on a page and even blocks that are rendered in the background but not displayed.
Login or register to post comments
I think this is due to
I think this is due to running xhprof in my Dev environment. Presumably in production these functions will run faster because the distance to the Acquia agent server will be much less.
I'll give Block Timer a try
Login or register to post comments
Do you have Panel cache and
Do you have Panel cache and View cache enabled ? Seems Memcached gets are really few.
Need Drupal help?
Reach Me
Share your Posts, Url, Sites
www.sociopost.com
Login or register to post comments
I this case this is a node
I this case this is a node page. Panels cache is active for things that are 'global'. Activating it for node content really isn't that helpful. Once a page is hit once it gets cached by varnish for 10 minutes. Most of the traffic is anonymous.
Maybe entity cache with a cache warmer would help
Login or register to post comments
Also we have had to move
Also we have had to move parts of the cache back to the Database. Memcache seems to run out of memory if we leave the entire cache memcache. Page cache and views cache use the db cache.
Login or register to post comments
what's the peak traffic?
1.5 million pageviews/mo may or may not break down into a lot of concurrent page requests/sec. is the site slow all the time or just during peak loads?
also, have you verified that varnish is caching or identified what URLs are missing? or could you increase the ttl or use content based caching (a la acquia purge)?
fwiw, unless you have some super traffic spikes, on a normal and properly configured site; i would think 99.9% of anon visitors are only having a speedy varnish cached experience.
if the site is marketplace.org, the ttl is 600 seconds. just clicking around, i got mostly quick response times but hit a number of cache misses. i noticed a couple of cache counts around 200, but most were lower in the 10s. i realize this is a news site, but if the traffic covers a normal distribution of URLs--i'd guess quite a few visitors get cache misses b/c of the 10m ttl. varnish could effectively be covering the homepage and a few top links here.
Loudon & Company Consulting
Login or register to post comments
Yeah 10 minute ttl seems to
Yeah 10 minute ttl seems to be the most I can get away with for political reasons much more than technical ones. I could try for much longer cache and then selective clearing but the real problem is 200 + modules and scores of features that are not built for performance - the site needs an audit and a significant rebuild with performance in mind. The current build was more of a situation where they made mockups and threw all the modules they could at it to make it work, look and act like the mock up.
Login or register to post comments
Could you write a crawler to verify cache hits/misses?
If you write a crawler that hits your top 100 URLs (say 1 every 3 seconds 6 times a day) and stores the HEAD, in particular:
X-Age:
X-Cache-Hits:
You would be able to tell how effective your caching policy is. I don't think it would be super difficult/time-consuming to write. I could post a gist of something close in ruby...but it might be nice to hijack some boost?? code so it could have a dynamic URL list instead of a static one.
I'm not sure you're going to be able to do a whole lot to improve the speed. Try running ab or whatever benchmarking tool you like against a file that just bootstraps Drupal--no menu routing, no rendering, etc. I would look at better caching policies, but YMMV.
Cheers
Loudon & Company Consulting
Login or register to post comments
I actually did a very similar
I actually did a very similar thing in NodeJS a few months back. It would load the front page every couple of hours, then hit the 6 tops stories, all in different threads (using the cluster module). I also recorded the stat output from Apache stats as well as various server metrics (load, memory, network and disk IO, running processes). Took less than 30 minutes to write (thanks to about a half dozen node modules) and helped me track down a problem that plagued me for a couple of months.
HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.
Login or register to post comments
Selective cache clearing can
Selective cache clearing can go a long way (if a new blog post is written, only clear the blog home page, etc.).
And then ESI (Edge Side Includes) to have different caching rules for different parts of a single page (e.g. the 'most popular' block probably doesn't need to be updated more than once an hour and is the same for every page on the site).
--
Dave Hansen-Lange
Technical Manager
Advomatic LLC
Great White North Office
Canada
Login or register to post comments
ESI Resources/Tips?
Hey Dave,
I haven't seen too many references to sites using the ESI module or sites using ESI in the wild period.
I set it up for one client that had huge traffic demands, but it took a lot of effort and was very difficult to debug. I ran into issues w/ module compatibility w/ ESI blocks, ESI panels, and IIRC context, etc--it's been over a year at this point, so I can't totally remember all the details. It was just a beast.
Anyway, I did see authcache 2-x is geared toward ESI tho and seem to remember hearing Symfony/D8 has solid ESI support. So it looks like there's some cool stuff on the horizon :)
Do you know of many sites running Drupal w/ ESI or any good resources? I'd like to catch up on the current-state--I may need it on a project here in the near future.
Thanks!
来自 https://groups.drupal.org/node/410953