Skip to content

Commit

Permalink
dlb: add how to use
Browse files Browse the repository at this point in the history
Signed-off-by: Loong <[email protected]>
  • Loading branch information
daixiang0 committed May 14, 2024
1 parent f0c2329 commit 9f66412
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: 10000
connection_balance_config:
extend_balance:
name: envoy.network.connection_balance.dlb
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.connection_balance.dlb.v3alpha.Dlb
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: backend
domains:
- "*"
routes:
- match:
prefix: "/"
route:
cluster: service1
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

clusters:
- name: service1
load_assignment:
cluster_name: service1
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: 12000
59 changes: 56 additions & 3 deletions docs/root/configuration/other_features/dlb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,60 @@ If enabled, the Dlb connection balancer will:
When new connections come, one worker thread will accept it and send it to Dlb hardware. Dlb hardware
does balancing then trigger one worker thread to receive via libevent.

Installing and using Dlb
------------------------
Installing Dlb
--------------

For information on how to build/install and use libdlb see `the getting started guide <https://downloadmirror.intel.com/727424/DLB_Driver_User_Guide.pdf>`_.
Download DLB driver release tarball from `dlb website <https://www.intel.com/content/www/us/en/download/686372/intel-dynamic-load-balancer.html>`_, then install it refer to `the getting started guide <https://downloadmirror.intel.com/727424/DLB_Driver_User_Guide.pdf>`_.


Using Dlb
---------

Create a config file to make Envoy listen 10000 port as proxy, the upstream server listens 12000 port.

.. literalinclude:: _include/dlb_example_config.yaml
:language: yaml

Run the upstream service:

.. code-block:: bash
$ docker run -d -p 12000:80 nginx

Run Envoy with dlb enabled:

.. code-block:: bash
$ ./envoy --concurrency 2 -c dlb-config.yaml

Test:

.. code-block:: bash
$ curl localhost:10000

You should get output from Nginx like below:
.. code-block:: text
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

0 comments on commit 9f66412

Please sign in to comment.