您好,欢迎来到济南诺商官方网站!
当前位置:首页 -> 新闻中心 -> 如何构架一个高性能的分布式网站?

如何构架一个高性能的分布式网站?

时间:2018.07.03 来源:http://www.weidaoshang.cn

首先,我们要知道大型网站具有什么样的特点:
First of all, we need to know what the characteristics of large websites are:
1.用户多,分布广泛
More than 1. users, widely distributed
2.大流量,高并发
2. large flow, high concurrency
3.海量数据,服务高可用
3. massive data, high availability of services
4.安全环境恶劣,易受网络攻击
4. bad security environment, vulnerable to network attack
5.功能多,变更快,频繁发布
5. functions, fast change, frequent release
6.从小到大,渐进发展
6. from small to large, gradual development
7.以用户为中心
7. user centered
8.免费服务,付费体验

8. free service, pay experience


商河做网站

高性能的架构是以用户为中心,提供快速的网页访问体验,主要参数有较短的响应时间、较大的并发处理能力、较高的吞吐量与稳定的性能参数。

The high performance architecture is user centric and provides fast web access experience. The main parameters are short response time, larger concurrency processing capability, higher throughput and stable performance parameters.
可分为前端优化、浏览器优化、应用层优化、代码层优化与存储层优化:
It can be divided into front-end optimization, browser optimization, application level optimization, code level optimization and storage layer optimization.
前端优化:网站业务逻辑之前的部分。
Front end optimization: part of the website's business logic.
浏览器优化:减少 HTTP 请求数,使用浏览器缓存,启用压缩,CSS JS 位置,JS 异步,减少 Cookie 传输;CDN 加速,反向代理。
Browser Optimization: reduce the number of HTTP requests, use browser caching, enable compression, CSS JS location, JS asynchronous, reduce Cookie transmission; CDN acceleration, reverse proxy.
应用层优化:处理网站业务的服务器。使用缓存,异步,集群。
Application level optimization: server that handles website business. Use caching, asynchronous, cluster.
代码优化:合理的架构,多线程,资源复用(对象池,线程池等),良好的数据结构,JVM调优,单例,Cache 等。
Code optimization: reasonable architecture, multithreading, resource reuse (object pool, thread pool, etc.), good data structure, JVM tuning, singleton, Cache and so on.
存储优化:缓存、固态硬盘、光纤传输、优化读写、磁盘冗余、分布式存储(HDFS)、NoSQL 等。
Storage optimization: cache, solid-state hard disk, optical fiber transmission, optimized read and write, disk redundancy, distributed storage (HDFS), NoSQL and so on.

利用缓存改善网站性能
Using caching to improve Web Performance
在硬件优化性能的同时,也通过软件进行性能优化,在大部分的网站系统中,都会利用缓存技术改善系统的性能。
While optimizing the performance of the hardware and optimizing the performance of the software, most of the website systems will use cache technology to improve the performance of the system.
使用缓存主要源于热点数据的存在,大部分网站访问都遵循 28 原则(即 80% 的访问请求,最终落在 20% 的数据上),所以我们可以对热点数据进行缓存,减少这些数据的访问路径,提高用户体验。
The use of caching is mainly due to the presence of hot data. Most site visits follow 28 principles (i.e. 80% access requests, and eventually fall on 20% data), so we can cache the hot data, reduce the access path of these data, and improve the user experience.
缓存实现常见的方式是本地缓存、分布式缓存。当然还有 CDN、反向代理等。
The common way to cache is local caching and distributed caching. Of course, there are CDN, reverse agents, and so on.
本地缓存,顾名思义是将数据缓存在应用服务器本地,可以存在内存中,也可以存在文件,OSCache 就是常用的本地缓存组件。
Local caching, as the name implies, caches data in the application server local, can exist in memory, and can exist files, OSCache is a common local caching component.
本地缓存的特点是速度快,但因为本地空间有限所以缓存数据量也有限。
Local caching is characterized by high speed, but because of limited local space, the amount of data cached is limited.
分布式缓存的特点是,可以缓存海量的数据,并且扩展非常容易,在门户类网站中常常被使用,速度按道理没有本地缓存快,常用的分布式缓存是 Memcached、Redis。
The feature of distributed caching is that it can cache massive amounts of data and is very easy to extend. It is often used in portal type sites. The speed is not fast according to the local cache. The common distributed cache is Memcached and Redis.

大型网站的架构是根据业务需求不断完善的,根据不同的业务特征会做特定的设计和考虑.

The structure of large websites is constantly improved according to the needs of the business, and specific design and consideration will be made according to different business characteristics.

商河网络公司