网站资源预加载提高访问速度_如何使您的网站更快地为访问者加载

网站资源预加载提高访问速度

One thing that webmasters tend to neglect is the speed at which their web pages load. Just as some food for thought, here is what a 1 second delay in the time it takes for a page to load causes:

网站管理员往往忽略的一件事是其网页加载的速度。 值得深思的是,这是导致页面加载时间延迟1秒的原因 :

  1. 11% fewer page views

    页面浏览量减少11%
  2. Customer satisfaction decreases by 16%

    客户满意度下降16%
  3. Up to a 7% loss in conversions (turning visitors into sales)

    转化损失高达7%(将访问者转化为销售)

With these figures in mind, you’re probably asking yourself why you’ve never given page loading speeds serious consideration. Well, it’s not too late to take action. Adapting your website to deliver fast loading speeds is a project that can be worked in progressively – in most cases, there’s no single fix, rather improved speeds require some front-end trickery coupled with some adaptations to backend code.

考虑到这些数字,您可能会问自己,为什么从未认真考虑过页面加载速度。 好吧,采取行动还为时不晚。 使您的网站适应快速的加载速度是一个可以逐步进行的项目-在大多数情况下,没有一个解决方案,而提高速度需要一些前端技巧,并需要对后端代码进行一些调整。

优化服务器性能 (Optimise server performance)

If your website is running on a server that is already sluggish, then of course it is going to take longer to process and deliver your web pages. Server performance is something that can be impacted by age, running too many applications, or just neglecting to maintain the machine properly.

如果您的网站运行在已经很慢的服务器上,那么处理和交付网页的时间当然会更长。 服务器性能可能会受到使用时间,运行太多应用程序或忽略维护计算机的影响。

If you are running your websites on your own server then you should take advantage of this unique position to adapt your server so that you are only running the applications and services that are conducive to the running of your websites. This will help to free up server resources that can then be used by the applications that you have remaining, which should hopefully deliver a performance boost that will hopefully include the faster delivery of your web pages.

如果您在自己的服务器上运行网站 ,则应利用这一独特的优势来调整服务器,以便仅运行有利于网站运行的应用程序和服务。 这将有助于释放服务器资源,然后这些资源可以供剩余的应用程序使用,从而有望提高性能,包括更快地交付网页。

减少数据库调用 (Reduce database calls)

One of the biggest drags on a web page can be the number of database calls it needs to make to retrieve its content. Not only do database calls place extra load on the server when the page is being loaded, but they also slow down the processing of the page whilst it waits for the information to be fetched from the database.

网页上最大的阻力之一就是检索内容所需的数据库调用数量。 不仅正在加载页面时调用数据库放置在服务器上的额外负担,但同时它等待信息从数据库中获取他们也减慢页面的处理。

Using additional modules, such as mem cache, you can cache certain elements of database data in the server’s memory so that only one call ever needs to be made fetch certain bits of information. Obviously you’re going to be needing to make more frequent calls for content and other items that are created or modified on a regular basis, but for items that are likely to remain more static such as menu elements, cacheing represents a more resource efficient method of displaying this information whilst reducing the number of database queries performed.

使用诸如内存缓存之类的其他模块,您可以将数据库数据的某些元素缓存在服务器的内存中,这样就只需要进行一次调用就可以获取某些信息位。 显然,您将需要更频繁地调用内容以及定期创建或修改的其他项目,但是对于那些可能保持更静态状态的项目(例如菜单元素), 缓存代表了一种更节省资源的方法显示此信息的同时减少执行的数据库查询的数量。

Where information is being fetched from cache memory, you will see an increase in page loading speeds compared with the same information being queried from a database.

从高速缓存中获取信息的地方,与从数据库查询相同信息相比,页面加载速度将会提高。

启用压缩 (Enabling compression)

It is estimated that compressing your HTML and CSS files can reduce the file footprint by around 50-70%, which is a lot by any measure. This means that not only will your web pages load faster for those accessing them, but also the amount of bandwidth used in each request will be substantially reduced so that the bandwidth you do have available will stretch further and enable you to receive more visitors for the same allocation. Enabling compression on web pages is now seen as standard practice and can be achieved using the following methods:

据估计,压缩HTML和CSS文件可以将文件占用空间减少约50-70%,无论如何,这都是很大的。 这意味着您的网页不仅可以为访问它们的用户更快地加载,而且每个请求中使用的带宽量都将大大减少,从而使您拥有的可用带宽进一步扩大,并使您可以为相同的分配。 现在,在网页上启用压缩已被视为一种标准做法,可以使用以下方法来实现:

  •  Mod_deflate on Apache

    在Apache上的Mod_deflate
  • Http Gzip Module on Nginx

    Nginx上的Http Gzip模块

  • ‘Configure HTTP Compression’ on IIS

    在IIS上“配置HTTP压缩”

图片 (Images)

You’re probably using images somewhere on your website. The improvement in digital camera sensors and the larger resolution that adorns the average computer monitor has led to much larger images being used on web pages, whether these have been taken with a camera or created in Photoshop.

您可能正在网站上的某处使用图像。 数码相机传感器的改进和普通计算机显示器所采用的更高的分辨率导致网页上使用的图像大得多,无论这些图像是用相机拍摄的还是在Photoshop中创建的。

It’s quite easy to just FTP an image into your web page, link to it using the ‘img’ tag in your code or through CSS and then resize it on the fly. This is the lazy man’s option. By reducing the size of the image on the fly, you’re adding in more code where it’s not necessary and you’re loading an image that is bigger than it really need to be – both of these scenarios will increase the amount of time it takes for your website to load. Resizing images to their precisely required size is the remedy to this situation because then you will be loading an image which is at the size that it needs to be and you can remove the code in your CSS file or HTML file that was in place to resize it.

只需将图像通过FTP传输到您的网页中,使用代码中的“ img ”标签或通过CSS链接到它,然后即时调整其大小是很容易的。 这是懒人的选择。 通过动态减少图像的大小,您可以在不需要的地方添加更多代码,并且可以加载比实际需要更大的图像,这两种情况都会增加它的时间。需要您的网站加载。 将图像调整为精确所需的大小是解决这种情况的方法,因为这样一来,您将加载所需大小的图像,并且可以删除已调整大小CSS文件或HTML文件中的代码它。

优化 字体 -end (Optimise the font-end)

It’s not just server and page processing issues that can delay the delivery of your web pages; the components that the front-end design consists of can also cause issue with page speed. Poor HTML and CSS coding can cause delays for web browsers processing the output they’ve received, so creating clean HTML that is easy for web browsers to interpret is vital. Here are a few tips to get you started:

不仅服务器和页面处理问题可能会延迟网页的交付; 前端设计所包含的组件也会导致页面速度出现问题 。 可怜HTML和CSS编码可引起FO R的网络延迟BR owser 的公关 ocessing他们已经收到,所以创建HTML干净,很容易对网络浏览器来解释是至关重要的输出。 这里有一些提示,可以帮助您入门:

  •  Watch out for WYSIWYG editors; they might be handy for creating and editing pages on the fly, but more often than not they produce messy code that isn’t conducive to the good of your web pages

    注意所见即所得的编辑器; 它们可能很方便地动态创建和编辑页面,但更多时候它们会产生混乱的代码,不利于您的网页
  • Avoid inline CSS where possible because it just adds extra code to be processed, and any website that has been designed and built properly should use a universal set of styles stored in the stylesheet, so there should never be any need for inline CSS.

    尽可能避免使用内联CSS,因为它只会添加要处理的额外代码,并且任何已正确设计和构建的网站都应使用样式表中存储的一组通用样式,因此永远不需要内联CSS。

翻译自: https://www.eukhost.com/blog/webhosting/how-to-make-your-website-load-faster-for-your-visitors/

网站资源预加载提高访问速度

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值