提高 Drupal 性能和扩展性有很多方法。下面的表中选取了部分常用的性能和扩展性有关的模块,进行比较。
模块 (按下载量排序) | 发布版本 | 缓存类型 | 获得性能* | 匿名用户 / 注册用户** | 共享主机 / VPS / 独立主机 / 多台服务器*** | 更新状态 | 说明文档 |
---|---|---|---|---|---|---|---|
1. System | 包含在核心模块 | 数据库 | 中等 | 大部分匿名用户和全部注册用户 | 全部 | Yes | 用户手册 |
2. Javascript Aggregator | 5.x, 6.x | 文件 | 中等 | 全部 | 全部 | Yes | ? |
3. Boost | 5.x, 6.x | 对匿名用户直接调用文件缓存(使用.htaccess来避开php和db) | 非常高 | 匿名用户 | 全部 | 6.x yes 5.x no | 用户手册 |
4. Cache Router | 5.x-beta, 6.x-rc, 7.x-beta | 数据库、文件、PHP opcode和内存 | 根据设置从中等到非常高 | 根据设置 | 全部,根据设置 | Yes | 模块下载页面 |
5. CacheExclude | 5.x, 6.x | 数据库 | 中等 | 匿名用户 | 全部 | Yes | ? |
6. CSS Gzip | 6.x | 文件 | 中等 | 全部 | 全部 | Yes | ? |
7. Memcache API and Integration | 5.x, 6.x | 内存 | 高 | 大部分匿名用户 | VPS、独立主机或多台服务器 | Yes | 模块下载页面 |
8. Block Cache | 5.x-dev | 数据库 | 中等 | 全部 | 全部 | Yes | ? |
9. Block Cache Alter | 6.x | 数据库 | 中等 | 全部 | 全部 | Yes | ? |
10. Term Lower Name | 6.x | 数据库 | 中等 | 全部 | 全部 | 更新较少 | ? |
11. Path Cache | 6.x | 根据设置 | 中等 | 全部 | 全部 | 更新较少 | README.txt |
12. Advanced Cache | 5.x, 6.x-dev | 数据库 | 中等 | 大部分注册用户 | 全部 | Yes | 模块下载页面 |
13. Authcache | 6.x-rc | 数据库、文件、PHP opcode和内存 | 根据设置从中等到非常高 | 全部匿名用户,大多数注册用户 | 全部,更加设置 | Yes | 模块下载页面 |
14. Previous/Next API | 6.x-dev | 数据库 | 中等 | 全部 | 全部 | 较少更新 | 模块下载页面, 文章 |
15. fastpath_fscache | 4.7.x-dev, 5.x-rc, 6.x-dev | 对匿名用户调用文件缓存(避开db) | High | 匿名用户 | 全部 | Yes | Drupal的讨论 |
16. Varnish | 6.x-dev, 7.x-dev | Reverse proxy(虚拟内存) | 非常高 | 全部注册用户,大部分匿名用户 | VPS、独立主机或多台服务器 | 测试阶段 | Varnish和Project Mercury的讨论 |
模块 (按下载量排序) | 发布版本 | 缓存类型 | 获得性能* | 匿名用户 / 注册用户** | 共享主机 / VPS / 独立主机 / 多台服务器*** | 更新状态 | 说明文档 |
注释
- (*) 在默认的数据库缓存作用下获得的性能中等 ,而在调用大量数据时使用文件、PHP opcode、proxy 和内存缓存获得性能就能提高 。缓存的使用可以减少 PHP 的运行和数据库的查询次数,从而提高网站速度、性能和扩展性。非常高 就 是完全跳过(Boost, Varnish)。同样,同时使用几个高性能缓存模块也可以获得非常高的性能,例如:APC+Memcache 或者 Cache Router,通过 PHP opcode 缓存加上通过较快的内存缓存来跳过数据库,可以加快 PHP 速度。
- (**) 通常下正对匿名用户和注册用户,两个或以上的缓存模块可以同时使用。
- (***) 文件和数据库缓存可以应用与所有类型的主机(包括共享主机)。PHP opcode、proxy 和内存缓存可以应用在 VPS、独立主机或多台服务器;共享主机通常没有服务器足够的权限。在其他可能的配置中,文件缓存适合共享主机,PHP opcode 适合 VPS 和独立主机,and proxy 和内存缓存适合多台服务器。
描述
- Authcache 同时为匿名用户和注册用户提过页面缓存。现在默认情况下使用标准的数据库做缓存,但是它也有值得推荐的与其他缓存控制模块进行整合的模式(例如:Cache Router 或 Memcache)来改善性能。
- Boost 出来匿名用户时,可以提供静态页面的缓存,通过使用.htaccess来完全避开 PHP 和数据库。这样可以获得出色的速度和性能,来和完全静态的网站相媲美,这样 PHP 服务器如 Apache 可以轻松的出来每秒上百的高页面请求。想主机商经常说:在动态内容下(没有使用这个缓存模块)这个请求量会导致部分用户请求失败(无法打开网页)。参见 Drupal 的静态页面缓存 ,文中含有数据库缓存和静态页面缓存的比较结果的图例。
- Cache Router 需要结合以下模块的重写代码一起工作:database cache、file cache (fastpath_fscache)、PHP opcode cache (APC, eAccelerator, XCache)、memory cache (Memcache)。参见 Drupal 使用 Cache Router 模块进行缓存 。
- fastpath_fscache 是一个基于文件缓存机制的模块,来替代 Drupal's 页面缓存,对与匿名用户可以避开数据库。参见 Drupal 的文章 基于文件的缓存 ,来了解它的发展。
- Memcache 包含了使用 Memcached 的 API 和 Drupal 要用到的 PECL 内存库 。它通过把对象保存在内容中来降低数据库的荷载量。
- Pressflow 不是一个模块,是从 Drupal 核心代码中派生出来,可以提高性能、扩展性和数据可靠性。
- Throttle 是一个控制拥堵的可选核心模块. 从 7.x-dev 起会从 Drupal 核心模块中移除 。
- Varnish 是一个测试阶段的模块,用于将 Drupal 网站和 Varnish HTTP Accelerator 进行整合,一种快速反转代理缓存,把数据保存在虚拟内存中(RAM 和 disk)。它是 Project Mercury (Pressflow + Varnish) 的一部分,现在在 Drupal 的 High performance 小组进行讨论, 同时在 Chapter Three 。
监控与问题调试模块
讨论性能的文章导读
- Advcache and memcached benchmarks with Drupal - Normal cache, aggressive cache, Memcache.
- Benchmarking APC vs. eAccelerator using Drupal - APC, eAccelerator.
- Benchmarking Drupal with PHP op-code caches: APC, eAccelerator and XCache compared - APC, eAccelerator, XCache.
- Can a Drupal web site handle a million page views a day? - Memcache without the database caching.
- Drupal vs Joomla: performance - Database cache, gzip.
- Drupal webserver configurations compared - Database cache, APC, mod_php, FastCGI, etc.
- Project Mercury Benchmarks: 2000+ Requests Per Second! - Project Mercury (Pressflow + Varnish), standard page cache (database), aggressive caching, APC, Cache Router (Memcache).
- Static Page Caching for Drupal - Static page cache (Boost), and standard database cache.
- United Nations Uses Drupal for Anti-Poverty Event - Block Cache, Boost.
推荐阅读
- Performance and scalability modules - List of modules sorted by usage statistics in descending order, most used first.
- Drupal caching, speed and performance - Basic configuration, and extensive guide to Drupal performance resources.
- Comparisons of contributed modules - Other comparisons of Drupal modules for several topics.
- Updated comparison of performance modules - Discussion on this wiki page.
To do
List of requirements of each package: memory, etc... Degree of difficulty Maturity DoD
其他模块
生产静态 HTML 文件 - 仅对匿名用户有效:
- http://drupal.org/project/cachestatic
- http://drupal.org/project/html_export
- http://drupal.org/project/savetoftp
缓存技术:
数据库缓存:Drupal 的核心模块
文章说明
- 参考文章地址:Caching: Modules that make Drupal scale
- 原文作者:Cityreader
- 原文地址:http://www.mypetal.com/library/drupal/caching-modules-make-drupal-scale