Home php教程 php手册 PHP大型网站的提速(页面静态化)(一)

PHP大型网站的提速(页面静态化)(一)

Jun 06, 2016 pm 08:00 PM
php Large University speed up static page

大型网站的核心技术有哪些 ( 带宽 / 数据库 ) 连接池 1.页面静态化 ( 核心把动态的页面转成静态页面从而减少对数据库操作的次数 ) 2.缓存技术 ( 内存角度存储 -memcached) 3.服务器集群 (a. 硬件 b. 软件架构 ) 简单介绍 - 示意图 : 4.数据库优化 (a. 表结构

大型网站的核心技术有哪些(带宽 数据库  )

连接池

1. 页面静态化 核心 把动态的页面 转成 静态页面 从而减少对数据库操作的次数 )

2. 缓存技术(内存角度存储->memcached)

3. 服务器集群(a. 硬件 b. 软件架构)

简单介绍 -> 示意图:

 PHP大型网站的提速(页面静态化)(一)

4. 数据库优化(a. 表结构(符号3NF) b. 添加适当索引 (1.1主键索引 1.2 普通索引 1.3 唯一索引 1.4 全文索引 sphinx ) c. 读写分离 d. 分表(垂直分割 水平分割 ) )

 

 

 

u 页面静态化技术

 

u 几个重要的概念

 

1. 静态网址

举例: http://localhost/test.html  

当我们的页面是 静态页面时, 则,我们放的url 就是一个静态网址

好处是 a. 利用seo (search engine optimization ) 搜索引擎优化. b. 防止sql注入攻击

c. 不操作数据库,所以效率高

 

2. 动态网址

举例 :  http://localhost/test.php?age=80

特点是一般说可以接受用户的数据,

http://localhost/news.php?lang=cn&class=1&id=2

动态网址,不利用SEO ,因为搜索引擎认为,动态网页的内容一般说都会和数据库相关,所以 搜索引擎就会放弃抓取.

 

3. 伪静态网址

我们公司开发是,为了SEO,同时为了防止 注入攻击,往往会把 动态网站 改写成 静态网址 这样的网址,我们称为伪静态

http://localhost/news.php?lang=cn&class=1&id=2

 

希望

http://localhost/news-cn-sport-id2.html (这个网址就是伪静态),但是请大家注意,伪静态网站不是真正的静态页面,所以,只是形式上的,访问它,仍然会访问数据库

 

=>伪静态技术

 

u 页面静态化的分类

1. 从形式上分为 真静态和伪静态

2. 从范围看: 整体静态化,和局部静态

 

 

介绍一款工具 apache自带的 ab.exe 程序,该程序可以用于测试 你的页面的效率怎样同时可以测试你的apache的负载能力有多大! , 该程序在控制台下使用

 

使用的语法:

ab.exe 请求的次数  -c 并发次数 访问的页面的url地址

 

说明  并发次数 在同一个时间点,发出的请求次数 

 

举例说明

写一个  test1.php 页面

 

ab.exe –n 10000 –c 100 http://localhost/test1.php

 

注意如何看统计信息:

 PHP大型网站的提速(页面静态化)(一)

 

后面我们给了一个大致的结论:

① 网站能支撑的在线人数大致是支撑 并发人数的 10左右

② htmlPHP访问的效率表

 PHP大型网站的提速(页面静态化)(一)

 

u 怎样的Html文件,会符号 SEO 的喜好

1. url  不要超过 255

2. 静态页面不要带参数 ,造成重复抓取

3. meta 数据尽量完善

4. PHP大型网站的提速(页面静态化)(一).png” alt=”小明”/> 

5. 页面不在建议使用 框架 frame/frameset/iframe 不建议在前端页面使用 

 

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles