Apache Traffic Server™ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 个月前 | ||
| 9 个月前 | ||
| 1 个月前 | ||
| 8 个月前 | ||
| 5 天前 | ||
| 25 天前 | ||
| 4 天前 | ||
| 5 天前 | ||
| 3 天前 | ||
| 5 天前 | ||
| 6 个月前 | ||
| 8 小时前 | ||
| 19 天前 | ||
| 3 天前 | ||
| 1 年前 | ||
| 8 小时前 | ||
| 3 天前 | ||
| 4 天前 | ||
| 1 个月前 | ||
| 7 年前 | ||
| 2 年前 | ||
| 6 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 7 个月前 | ||
| 4 个月前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 9 年前 | ||
| 2 年前 | ||
| 1 个月前 | ||
| 24 天前 | ||
| 3 天前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 5 年前 | ||
| 2 个月前 | ||
| 5 年前 | ||
| 2 个月前 | ||
| 3 个月前 | ||
| 4 年前 | ||
| 16 年前 | ||
| 9 年前 | ||
| 2 年前 |
Apache Traffic Server
Traffic Server 是一款高性能的云服务基础组件。它不仅是一个缓存代理服务器,还支持通过插件构建大规模 Web 应用程序。
致 ATS 开发者的重要通知
从 10 版本开始,ATS 已将构建系统转换为 cmake。以下是使用 cmake 构建 ATS 的快速入门指南:
步骤 1:配置
使用 cmake 时,强烈建议创建一个源外构建目录。所有 cmake 命令都需要指定该目录。在以下示例中,该目录为 build。
$ cmake -B build
这将使用默认值配置项目。
如果您想自定义构建,可以在命令行中为变量传递值。或者,您可以使用 ccmake 程序交互式地修改这些变量。
$ cmake -B build -DCMAKE_INSTALL_PREFIX=/tmp/ats -DBUILD_EXPERIMENTAL_PLUGINS=ON
-- 或 --
$ ccmake build
指定依赖项的位置
若要指定依赖项的位置(类似于 autotools 构建中的 --with-*),通常需要设置一个带有 ROOT 的变量。不过 openssl 是一个主要例外,其对应的变量名为 OPENSSL_ROOT_DIR。
$ cmake -B build -Djemalloc_ROOT=/opt/jemalloc -DOPENSSL_ROOT_DIR=/opt/boringssl
使用预设配置构建
cmake 具有将配置分组的功能,以简化配置和重现过程。文件 CMakePresets.json 声明了可从命令行使用的预设。您可以提供自己的 CMakeUserPresets.json,并通过继承进一步优化这些预设:
$ cmake --preset dev
您可以通过复制 CMakePresets.json 并删除 configurePresets 中的所有内容来开始创建用户预设。
以下是一个用户预设示例:
{
"name": "clang",
"hidden": true,
"environment": {
"LDFLAGS": "-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++ -fuse-ld=/opt/homebrew/opt/llvm/bin/ld64.lld",
"CPPFLAGS": "-I/opt/homebrew/opt/llvm/include",
"CXXFLAGS": "-stdlib=libc++",
"CC": "/opt/homebrew/opt/llvm/bin/clang",
"CXX": "/opt/homebrew/opt/llvm/bin/clang++"
}
},
{
"name": "mydev",
"displayName": "my development",
"description": "My Development Presets",
"binaryDir": "${sourceDir}/build-dev-clang",
"inherits": ["clang", "dev"],
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "/opt/ats-cmake",
"jemalloc_ROOT": "/opt/homebrew",
"ENABLE_LUAJIT": false,
"ENABLE_JEMALLOC": true,
"ENABLE_MIMALLOC": false,
"ENABLE_MALLOC_ALLOCATOR": true,
"BUILD_EXPERIMENTAL_PLUGINS": true,
"BUILD_REGRESSION_TESTING": true
}
},
然后像这样使用:
cmake --preset mydev
构建项目
$ cmake --build build
$ cmake --build build -t traffic_server
运行测试
$ cd build
$ ctest
安装
$ cmake --install build
目录结构
trafficserver ............. Top src dir
├── ci .................... Quality assurance and other CI tools and configs
├── cmake ................. CMake build system files
├── configs ............... Configurations
├── contrib ............... Various contributed auxiliary pieces
├── doc ................... Documentation for Traffic Server
│ ├── admin-guide ....... Admin guide documentations
│ ├── appendices ........ Appendices of Traffic Server
│ ├── developer-guide ... Documentation for developers
│ ├── dot ............... Graphviz source files for docs pictures
│ ├── static ............ Static resources
│ └── uml ............... Documentation in UML
├── example ............... Example plugins
├── ext ................... External dependencies and extensions
├── include ............... Header files
├── lib ................... Third-party libraries
│ ├── Catch2 ............ Unit testing framework
│ ├── fastlz ............ Fast compression library
│ ├── highway ........... Portable SIMD/vector intrinsics
│ ├── ls-hpack .......... HPACK compression for HTTP/2
│ ├── swoc .............. Solid Wall of Code utility library
│ ├── systemtap ......... SystemTap integration
│ └── yamlcpp ........... YAML parser library
├── memory-bank ........... AI assistant context documentation
├── plugins ............... Stable core plugins
│ └── experimental ...... Experimental core plugins
├── rc .................... Installation programs and scripts
├── src ................... Source for all the main binaries / applications
│ ├── api ............... C Plugin API implementation
│ ├── cripts ............ Cripts scripting framework
│ ├── iocore ............ I/O core subsystem
│ │ ├── aio ........... Asynchronous I/O core
│ │ ├── cache ......... Disk and RAM cache
│ │ ├── dns ........... DNS (asynchronous)
│ │ ├── eventsystem ... Event Driven Engine
│ │ ├── hostdb ........ Internal DNS cache
│ │ ├── io_uring ...... io_uring support (Linux)
│ │ ├── net ........... Network I/O
│ │ │ └── quic ...... QUIC implementation
│ │ └── utils ......... I/O utilities
│ ├── mgmt .............. JSONRPC server/management and tools
│ ├── proxy ............. HTTP proxy logic
│ │ ├── hdrs .......... Headers parsing and management
│ │ ├── http .......... HTTP/1.x implementation
│ │ ├── http2 ......... HTTP/2 implementation
│ │ ├── http3 ......... HTTP/3 implementation
│ │ ├── logging ....... Flexible logging
│ │ └── shared ........ Shared proxy files
│ ├── records ........... Configuration records library
│ ├── shared ............ Shared utilities and RPC
│ ├── traffic_cache_tool Tool to interact with the Traffic Server cache
│ ├── traffic_crashlog .. Helper process that catches Traffic Server crashes
│ ├── traffic_ctl ....... Command line management tool
│ ├── traffic_layout .... Display information on the build and runtime directory structure
│ ├── traffic_logcat .... Convert binary log file to plain text
│ ├── traffic_logstats .. Log parsing and metrics calculation utility
│ ├── traffic_quic ...... QUIC client tool
│ ├── traffic_server .... Main proxy server
│ ├── traffic_top ....... Top like tool for viewing Traffic Server statistics
│ ├── traffic_via ....... Tool for decoding the Traffic Server Via header codes
│ ├── tscore ............ Base / core library
│ ├── tscpp ............. C++ api wrapper for plugin developers
│ └── tsutil ............ Core utilities (metrics, debugging, regex, etc.)
├── tests ................. Different tests for Traffic Server
├── tools ................. Directory of various tools
├── CONTRIBUTING.md ....... How to contribute to the project
├── INSTALL ............... Build and installation guide
├── LICENSE ............... Full license text
├── NOTICE ................ Copyright notices
├── README.md ............. This file: intro, links, build info
├── README-EC2 ............ Info on EC2 support
├── SECURITY.md ........... Security policy and vulnerability reporting
└── STATUS ................ Release history and information
要求
本节概述了不同操作系统发行版的构建要求。与在线要求相比,此处信息可能已过时,在线要求请参见
https://cwiki.apache.org/confluence/display/TS/Building。
从 ATS v9.0.0 及更高版本开始,需要 gcc 7 或更高版本,因为我们现在使用并要求 C++17 标准。
Fedora / CentOS / RHEL:
cmake
ninja
pkgconfig
gcc/g++ or clang/clang++
openssl-devel
pcre2-devel
ncurses-devel and libcurl-devel(optional, needed for traffic_top)
libcap-devel (optional, highly recommended)
hwloc-devel (optional, highly recommended)
Ubuntu / Debian
cmake
ninja
pkg-config
gcc/g++ or clang/clang++
zlib1g-dev
libssl-dev
libpcre2-dev
libcap-dev (optional, highly recommended)
libhwloc-dev (optional, highly recommended)
libncurses5-dev (optional, required for e.g.: traffic_top)
libcurl4-openssl-dev (optional, required for e.g.: traffic_top)
Alpine Linux
build-base
libexecinfo-dev
pcre2-dev
libressl-dev
cmake
ninja
linux-headers
macOS(我们推荐使用 HomeBrew):
cmake
ninja
pkg-config
openssl
pcre2
FreeBSD
cmake
ninja
devel/gmake
devel/pkgconf
security/openssl
devel/pcre2
textproc/flex (optional, install newer version from ports, fix PATH)
devel/hwloc (optional, highly recommended)
从发行版构建
您可以从 Apache Traffic Server 官方网站下载最新的源代码:
https://trafficserver.apache.org/downloads
(或通过 URL 缩短器:http://s.apache.org/uG)。下载完成后,请按照以下说明操作:
tar jxvf trafficserver-9.1.3.tar.bz2
cd trafficserver-9.1.3
cmake -B build
cmake --build build
这将以 /usr/local 为目标前缀进行构建。您可以通过以下方式完成安装
sudo cmake --install build
从 Git 仓库构建
git clone https://github.com/apache/trafficserver.git # get the source code from ASF Git repository
cd trafficserver # enter the checkout directory
cmake --preset default # configure the build
cmake --build build-default # execute the compile
cmake --build build-default -t test # run tests (optional)
cmake --install build-default # install
在 EC2 上构建的说明
注意:或者,您可以使用“contrib”目录下的脚本,这些脚本将自动在 EC2 上安装 trafficserver,强烈推荐此方法。有关更多详细信息,请参见“README-EC2”。
使用 Ubuntu 时,以 root 用户身份执行以下操作
mkdir -p /mnt #EC2 Storage Mount, where storage is located
cd /mnt
git clone ... # get the source code from ASF Git repo
cd trafficserver # enter the checkout dir
cmake --preset default # configure the build
cmake --build build-default # execute the compile
cmake --build build-default -t test
cmake --install build-default
使用 Fedora Core 8 内核时,以 root 用户执行以下操作
mkdir -p /mnt #EC2 Storage Mount, where storage is located
cd /mnt
git clone ... # get the source code from ASF Git repo
cd trafficserver # enter the checkout dir
cmake --preset default # configure the build
cmake --build build-default # execute the compile
cmake --build build-default -t test # run tests (optional)
cmake --install build-default # install
安装
/usr/local
├── /var/log/trafficserver log files created at runtime
├── /var/trafficserver runtime files
├── /etc/trafficserver configuration files
├── /bin executable binaries
└── /libexec/trafficserver plugins
加密软件声明
本发行版包含加密软件。您当前所在的国家/地区可能对加密软件的进口、拥有、使用和/或向其他国家/地区再出口存在限制。在使用任何加密软件之前,请务必检查您所在国家/地区关于加密软件进口、拥有、使用和再出口的法律、法规和政策,确认是否允许上述行为。更多信息请参见http://www.wassenaar.org/。
美国商务部工业与安全局(BIS)已将本软件归类为出口商品控制编号(ECCN)5D002.C.1,该类别包括使用非对称算法或执行加密功能的信息安全软件。Apache软件基金会的本发行版形式使其有资格根据许可例外ENC技术软件无限制(TSU)例外(参见BIS出口管理条例第740.13节)出口目标代码和源代码。
以下是所包含加密软件的更多详细信息:
本软件的部分功能使用了OpenSSL http://www.openssl.org/ 的功能。
模糊测试
标志
export CC=clang
export CXX=clang++
export CFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link"
export CXXFLAGS="-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link"
export LIB_FUZZING_ENGINE=-fsanitize=fuzzer
编译
cmake -B build -DENABLE_POSIX_CAP=OFF -DENABLE_FUZZING=ON -DYAML_BUILD_SHARED_LIBS=OFF
cmake --build build
补充信息
- 网页:https://trafficserver.apache.org/
- 维基:https://cwiki.apache.org/confluence/display/TS/
- 用户邮件列表:users@trafficserver.apache.org
项目介绍
Apache Traffic Server™ is a fast, scalable and extensible HTTP/1.1 and HTTP/2 compliant caching proxy server.
定制我的领域