generated from cotes2020/chirpy-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
85 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
layout: post | ||
title: Envoy | ||
date: 2024-12-18 10:55 -0800 | ||
categories: [network] | ||
tags: [network, envoy] | ||
--- | ||
|
||
Envoy is a proxy solution. There are so many proxies in the market: nginx, | ||
haproxy, trafik and etc, but why does Envoy stand out? It is because the xDS | ||
APIs, or a fancier name, xDS protocol. Envoy project incubated a protocol that | ||
allows dynamically changing proxy configurations using a channel between proxy | ||
and the management server. | ||
|
||
Alex Burnos has a | ||
[great article](https://medium.com/@aburnos/data-plane-control-plane-and-their-apis-explained-d0a3fa7291f3) | ||
talking about data plane, control plane and universal data plan API. Just to | ||
copy his explanation here: | ||
|
||
- data plane: proxies | ||
- control plane: management server | ||
- data plan API: the API for proxies and management server to talk to each | ||
other, i.e., xDS APIs. | ||
|
||
See Envoy's golang implementation of data-plane-api: | ||
<https://github.com/envoyproxy/go-control-plane>. | ||
|
||
## Build | ||
|
||
Follow the | ||
[official doc](https://github.com/envoyproxy/envoy/blob/ac61d8e000adc56d7505517cb4d6af5b82e08d22/bazel/README.md). | ||
|
||
``` | ||
brew install bazelisk | ||
cd ~/code/envoy | ||
# release build. Be cautious: too slow. Use a debug build instead. | ||
bazel build -c opt envoy | ||
# debug build | ||
bazel build --jobs=7 -c dbg envoy | ||
``` | ||
|
||
A gentle reminder: It took hours to build Envoy. There are over 14k source | ||
files to compile. The | ||
[official doc](https://www.envoyproxy.io/docs/envoy/latest/faq/build/speed) | ||
recommends using a machine with 36+ cores to build it. | ||
|
||
``` | ||
INFO: Elapsed time: 4138.131s, Critical Path: 348.04s | ||
INFO: 14847 processes: 3209 internal, 11636 darwin-sandbox, 1 local, 1 worker. | ||
``` | ||
|
||
Command to generate compilation database as following. | ||
|
||
``` | ||
TEST_TMPDIR=/tmp tools/gen_compilation_database.py | ||
``` | ||
|
||
It failed in my Macbook M1. To mitigate this issue, I need to comment out the | ||
`test` and `contrib` source code before running the python script. | ||
|
||
``` | ||
diff --git a/tools/gen_compilation_database.py b/tools/gen_compilation_database.py | ||
index 8153c1ad30..5d1cd470db 100755 | ||
--- a/tools/gen_compilation_database.py | ||
+++ b/tools/gen_compilation_database.py | ||
@@ -131,8 +131,6 @@ if __name__ == "__main__": | ||
parser.add_argument( | ||
'bazel_targets', nargs='*', default=[ | ||
"//source/...", | ||
- "//test/...", | ||
- "//contrib/...", | ||
]) | ||
``` | ||
|
||
## How to debug Envoy? | ||
|
||
Envoy has a set of admin endpoints for debug purpose. It even has an admin web | ||
UI. see | ||
[doc](https://www.envoyproxy.io/docs/envoy/latest/start/quick-start/admin). So | ||
we can know its internal state. |