网站时间的那些事

  • A+
所属分类:建站经验

我们想访问一个网站时,每次按下回车或是点击链接,都希望网站页面能尽快的映入到我们眼帘,那你知道每次等待的时间中,都发生了什么?

域名查询时间

我们需要知道,在网络中,两个设备间的通信是需要ip地址才可以的,也就是说,你每次访问网站时,都是通过ip地址实现的,可你输入的明明是域名,并不是ip,这又是什么情况呢?

原因就是你的电脑,会自动去询问设置在你电脑上的dns服务器,然后通过dns服务器返回的ip地址访问网站。而询问的过程,就是域名查询时间,大家可以用ping命令,测试一下与dns服务器的连接时间,可以大致得出域名查询时间。为什么说大致,因为ping命令只可以测出连接时间,dns还需要处理!

网络队列时间

电脑知道要访问网站的ip后,就会与之通信,而在网络中与之通信的不止是你一个,那么多人同时访问,先处理谁后处理谁?这时就需要排队了!排到你了,服务器自然会处理你的请求。

当然不只是网络资源要排队,服务器的内部处理进程,也需要排队的,等待排队还有数据处理,都需要时间的!

页面生成时间

以我们的博客为例,博客是使用php语言所写,通过mysql来存储数据,nginx为页面解析。所以php首先去找mysql索要数据,然后再通过nginx服务生成页面数据。

你的每次浏览php都需要去mysql中索要一次数据,然后再经过nginx生成,所以你会发现,有些网站打开后再刷新,速度并没有变很快!

文件传输时间

页面数据传输到你的浏览器之后,你的浏览器就会开始加载页面数据包含的文件,例如js库、css样式表、图片等等,这些时间就取决于你的带宽和浏览器的处理能力了。

一般的浏览器会默认缓存这些静态类文件(简单来说就是不会经常变的文件)使得再刷新时,不用重新下载,从而加快浏览速度!

  • 问答中心
  • 微信小程序扫一扫
  • weinxin
  • 微信公众
  • 微信公众号扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

目前评论:30   其中:访客  30   博主  0

    • avatar look at here now

      Hello my loved one! I wish to say that this article is awesome, great written and come with almost all significant infos. I’d like to peer more posts like this .

      • avatar Click here

        I have been browsing online greater than three hours today, but I never discovered any fascinating article like yours. It is pretty price enough for me. In my view, if all web owners and bloggers made just right content as you did, the web will probably be a lot more useful than ever before.

        • avatar Legal psychedelics for sale USA

          Hello there, I found your web site by means of Google while looking for a similar topic, your website got here up, it appears great. I’ve bookmarked it in my google bookmarks.

          • avatar grolyrtolemcs

            Hello.This article was really motivating, especially since I was browsing for thoughts on this subject last Friday.

            • avatar cbd oil that works 2020

              Greetings! Very helpful advice in this particular article!
              It is the little changes that produce the most
              important changes. Thanks for sharing!

              • avatar cbd oil that works 2020

                Hmm it seems like your website ate my first comment (it was extremely long) so I guess I’ll just sum it up what I wrote and say, I’m
                thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to the whole thing.
                Do you have any recommendations for rookie blog writers?
                I’d genuinely appreciate it.

                • avatar click here to read

                  Hey, you used to write wonderful, but the last several posts have been kinda boringK I miss your super writings. Past few posts are just a bit out of track! come on!

                  • Whoa! This blog looks just like my old one! It’s on a entirely different subject but it has pretty much the same layout and design. Superb choice of colors!

                    • avatar https://tinyurl.com/rsacwgxy g

                      Hi to all, it’s truly a pleasant for me to go to see this web page,
                      it contains priceless Information.

                      • avatar svolrfinotews

                        I would like to express my appreciation to you just for bailing me out of this particular predicament. After scouting through the the net and seeing techniques which are not beneficial, I was thinking my life was over. Living without the presence of approaches to the difficulties you have solved as a result of your main article is a critical case, as well as the ones which could have badly damaged my entire career if I hadn’t come across the website. Your own knowledge and kindness in playing with almost everything was useful. I don’t know what I would’ve done if I hadn’t discovered such a thing like this. I can now look forward to my future. Thanks for your time so much for your reliable and sensible help. I will not hesitate to endorse your blog post to any individual who should get direction on this problem.