Last active
October 15, 2023 08:39
-
-
Save johnlanni/46c61084bc92a419045ec9590293ebe7 to your computer and use it in GitHub Desktop.
higress http bench
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
docker-compose up | |
k6 run --vus 200 ./script.js --duration 60s |
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
version: '3.7' | |
services: | |
envoy: | |
image: higress-registry.cn-hangzhou.cr.aliyuncs.com/higress/envoy:1.20 | |
depends_on: | |
- nginx | |
networks: | |
- http | |
ports: | |
- "10000:10000" | |
command: ["envoy", "-c", "/etc/envoy/envoy.yaml", "--concurrency", "2"] | |
volumes: | |
- ./envoy.yaml:/etc/envoy/envoy.yaml | |
nginx: | |
image: nginx:1.23.4 | |
volumes: | |
- ./nginx.conf:/etc/nginx/nginx.conf | |
networks: | |
- http | |
networks: | |
http: {} |
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
admin: | |
address: | |
socket_address: | |
protocol: TCP | |
address: 0.0.0.0 | |
port_value: 9901 | |
static_resources: | |
listeners: | |
- name: listener_0 | |
address: | |
socket_address: | |
protocol: TCP | |
address: 0.0.0.0 | |
port_value: 10000 | |
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 | |
scheme_header_transformation: | |
scheme_to_overwrite: https | |
stat_prefix: ingress_http | |
route_config: | |
name: local_route | |
virtual_hosts: | |
- name: local_service | |
domains: ["*"] | |
routes: | |
- match: | |
prefix: "/" | |
route: | |
cluster: nginx | |
http_filters: | |
- name: envoy.filters.http.router | |
clusters: | |
- name: nginx | |
connect_timeout: 30s | |
type: LOGICAL_DNS | |
# Comment out the following line to test on v6 networks | |
dns_lookup_family: V4_ONLY | |
lb_policy: ROUND_ROBIN | |
load_assignment: | |
cluster_name: nginx | |
endpoints: | |
- lb_endpoints: | |
- endpoint: | |
address: | |
socket_address: | |
address: nginx | |
port_value: 80 |
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
worker_processes 2; | |
events { | |
accept_mutex off; | |
worker_connections 102400; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
server { | |
listen 80 backlog=20480 reuseport; | |
location / { | |
return 200; | |
} | |
} | |
} |
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
import http from 'k6/http'; | |
import { check, sleep } from 'k6'; | |
export default function () { | |
const res = http.get('http://127.0.0.1:10000/'); | |
check(res, { 'status was 200': (r) => r.status == 200 }); | |
} |
Author
johnlanni
commented
Jun 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment