waiting怎么读 ttfb 过长怎么解决

LoadRunner错误集锦_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
评价文档:
LoadRunner错误集锦
l​o​a​d​r​u​n​n​e​r​错​误​集​锦
阅读已结束,如果下载本文需要使用
想免费下载本文?
把文档贴到Blog、BBS或个人站等:
普通尺寸(450*500pix)
较大尺寸(630*500pix)
你可能喜欢I'm now at
User Agent
size (K-chars)
delta getItem (ms)
response- Start time
response- End time
dom- Loading time
BEFORE getItem time
AFTER getItem time
dom- Interactive time
Chrome Mobile 32
Firefox 27
Mobile Safari 7
Did we capture it?
The results from Table 1 show that Firefox’s localStorage precaching behavior is captured using Navigation Timing. The delta of responseStart and responseEnd (the time to read the HTML document) is 156 ms for Firefox. This doesn’t make sense since the HTML was read from cache. This should only take a few milliseconds, which is exactly what we see for all the other browsers that support Navigation Timing (Chrome, IE, and Opera).
Something else is happening in Firefox during the loading of the HTML document that is taking 156 ms. The likely suspect is Firefox precaching localStorage. To determine if this is the cause we reduce the amount of localStorage data to 10K. These results are shown in Table 2 (). With only 10K in localStorage we see that Firefox reads the HTML document from cache in 13 ms (responseEnd minus responseStart). The only variable that changed between these two tests was the amount of data in localStorage: 10K vs 5M. Thus, we can conclude that the increase from 13 ms to 156 ms is due to Firefox precaching taking longer when there is more localStorage data.
Table 2. 10K localStorage
User Agent
size (K-chars)
delta getItem (ms)
response- Start time
response- End time
dom- Loading time
BEFORE getItem time
AFTER getItem time
dom- Interactive time
Chrome Mobile 32
Firefox 27
Mobile Safari 7
Using Navigation Timing we’re able to measure Firefox’s precaching behavior. We can’t guarantee when it starts but presumably it’s after navigationStart. In this experiment it ends with responseEnd but that’s likely due to the page blocking on this synchronous disk read when the call to getItem() is reached. In the next section we’ll see what happens when the call to getItem() is delayed so there is not a race condition.
Does anyone else precache localStorage?
We discovered Firefox’s precaching behavior by comparing timings for localStorage with 10K versus the maximum of 5M. Using the same comparisons it appears that none of the other browsers are precaching localS the delta of responseStart and responseEnd for all other browsers is just a few milliseconds. We can investigate further by delaying the call to getItem() until one second after the window onload event. The results of this variation are shown in Table 3 ().
Table 3. maximum localStorage, delayed getItem
User Agent
size (K-chars)
delta getItem (ms)
response- Start time
response- End time
dom- Loading time
BEFORE getItem time
AFTER getItem time
dom- Interactive time
Chrome Mobile 32
Firefox 27
Mobile Safari 7
Table 3 confirms that Firefox is precaching localStorage – “delta getItem” is 0 ms because there was plenty of time for Firefox to finish precaching before the call to getItem(). All the other browsers, however, have positive values for “delta getItem”. The values for Chrome, Chrome Mobile, and IE are comparable between Table 1 and Table 3: 1038 vs
vs 1066, and 759 vs 872.
The values for Opera, Mobile Safari, and Safari are slower in Table 1 compared to Table 3: 930 vs 313, 453 vs 104, and 520 vs 177. I don’t have an explanation for this. I don’t think these browsers are precaching localStorage (the values from Table 3 would be closer to zero). Perhaps the call to getItem() took longer in Table 1 because the page was actively loading and there was contention for memory and CPU resources, whereas for Table 3 the page had already finished loading.
500K localStorage
So far we’ve measured maximum localStorage (Table 1) and 10K of localStorage (Table 2). Table 4 shows the results with 500K of localStorage. All of the “delta getItem” values fall between the 10K and maximum values. No real surprizes here.
Table 4. 500K localStorage
User Agent
size (K-chars)
delta getItem (ms)
response- Start time
response- End time
dom- Loading time
BEFORE getItem time
AFTER getItem time
dom- Interactive time
Chrome Mobile 32
Firefox 27
Mobile Safari 7
Conclusions
The goal of this blog post was to see if Firefox’s localStorage precaching behavior was measurable with Navigation Timing. We succeeded in doing that in this contrived example. For real world pages it might be harder to capture Firefox’s behavior. If localStorage is accessed early in the page then it may recreate the condition found in this test where responseEnd is blocked waiting for precaching to complete.
Another finding from these tests is that Firefox is the only browser doing precaching. This means that the simple approach of wrapping the first access to localStorage with timers accurately captures localStorage performance in all browsers except Firefox.
It’s hard not to focus on the time values from these tests but keep in mind that this is a small sample size. I did nine tests per browser for Table 1 and dropped to five tests per browser for Tables 2-4 to save time. Another important factor is that the structure of my test page is very simple and unlike almost any real world website. Rather than focus on these time values, it would be better to use the conclusions about how localStorage performs to collect real user metrics.
There are takeaways here for browser developers. There’s quite a variance in results across browsers, and Firefox’s precaching behavior appears to improve performance. If browser teams do more extensive testing coupled with their knowledge of current implementation it’s likely that localStorage performance will improve.
A smaller takeaway is the variance in storage size. Whether you measure by number of characters or bytes, Safari holds half as much as other major browsers.
Notes, Next Steps, and Caveats
As mentioned above, the time values shown in these results are based on a small sample size and aren’t the focus of this post. A good next step would be for website owners to use these techniques to measure the performance of localStorage for their real users.
In constructing my test page I tried various techniques for filling localStorage. I settled on writing as many strings as possible of length 1M, then 100K, then 10K, then 1K – this resulted in a small number of keys with some really long strings. I also tried starting with strings of length 100K then dropping to 1K – this resulted in more keys and shorter strings. I found that the first approach (with some 1M strings) produced slower read times. A good follow-on experiment would be to measure the performance of localStorage with various numbers of keys and string lengths.
With regard to how browsers encode characters when saving to localStorage, I chose to use string values that contained some non-ASCII characters in an attempt to force browsers to use the same character encoding.
In my call to getItem() I referenced a key that did not exist. This was to eliminate any variability in reading (potentially large) strings into memory since my main focus was on reading all of localStorage into memory. Another follow-on experiment would be to test the performance of reading keys of different states and lengths to see if browsers performed differently. For example, one possible browser optimization would be to precache the keys without the values – this would allow for more efficient handling of the case of referencing a nonexistant key.
A downside of Firefox’s precaching behavior would seem to be that all pages on the domain would suffer the penalty of reading localStorage regardless of whether they actually used it. However, in my testing it seemed like Firefox learned which pages used localStorage and avoided precaching on pages that didn’t. Further testing is needed to confirm this behavior. Regardless, it seems like a good optimization.
Thanks to Nicholas Zakas, Jonas Sicking, Honza Bambas, Andrew Betts, and Tony Gentilcore for providing advice and information for this post.当前访客身份:游客 [
当前位置:
本地请求 &且请求极其简单 只有个helloworld &但是waiting时间太长了 求教造成此问题的原因是???如何解决????
Apache2.4+php5.4
共有3个答案
<span class="a_vote_num" id="a_vote_num_
--- 共有 2 条评论 ---
猴哥你在逗我呀, 这么快就找到了
(6个月前)&nbsp&
找到原因了
(6个月前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
这他妈的waiting时间就是处理数据的时间 &请求到达服务器 &服务器根据请求内容去执行程序 &神马引入文件 载入类什么的 &都在这段时间内执行 & 得出结果后 &反馈回来 &尼玛~~~怪不得时间这么长 框架复杂度问题 &越复杂的框架 请求时间越长 我勒个嚓嚓嘣!!!!!
--- 共有 5 条评论 ---
: 我在想办法降低等待时间
看看有没有什么办法
因为这问题困扰我很久了
(6个月前)&nbsp&
: 猴哥这是精益求精做大项目的节奏啊
(6个月前)&nbsp&
我用几个框架都测试了 ZF
Symfony ThinkPHP Codeigniter Yii
统统走了不下10遍
每次请求完成后 都用xdebug记录
看了文件引用 类库加载 我去~~~这些时间加起来 刚好就是waiting时间
(6个月前)&nbsp&
为啥我的一个css有14秒的TTFB
(6个月前)&nbsp&
ZF、drupal惹的祸呀, 缓存吧
(6个月前)&nbsp&
<span class="a_vote_num" id="a_vote_num_
什么原因, 我也遇到了, 我静态资源也很长时间&
--- 共有 2 条评论 ---
其原因大多在于 程序文件加载
xdebug查的时候
很多时间耗在include上面
还有一些初始化的工作上
最近我看了一些可以编写常驻内存项目的语言 比如java python
就不存在这个问题
资源不会被释放掉
也就不存在反复引入文件等初始化操作了
(2个月前)&nbsp&
我至今未能解决这个问题
(2个月前)&nbsp&
有什么技术问题吗?
请叫我M...的其他问题

我要回帖

更多关于 怎么判断包皮是否过长 的文章

 

随机推荐