小编coo*_*ndy的帖子

Node.js + Nginx - 为什么这么慢?

我正在运行一个简单的ab测试来获取针对我的节点应用程序的性能指标。

当我ab直接针对应用程序运行时(针对10.0.0.5端口运行 5 个测试31005),我看到吞吐量为~1100 req/sec

> ab -q -n 12000 -c 300 -k "http://10.0.0.5:31005" | grep "Requests per second"

Requests per second:    1156.51 [#/sec] (mean)
Requests per second:    1201.85 [#/sec] (mean)
Requests per second:    1238.40 [#/sec] (mean)
Requests per second:    1392.68 [#/sec] (mean)
Requests per second:    1294.58 [#/sec] (mean)
Run Code Online (Sandbox Code Playgroud)

10.0.0.4同样,当我将 HAPrxoy (在port上运行8888)放在我的节点应用程序前面并运行相同的测试时,我看到非常相似的吞吐量:

> ab -q -n 12000 -c 300 -k "http://10.0.0.4:8888" | grep "Requests per second"

Requests …
Run Code Online (Sandbox Code Playgroud)

webserver reverse-proxy nginx node.js

6
推荐指数
0
解决办法
810
查看次数

Kubernetes Nginx Ingress找不到服务端点

我在让Nginx入口控制器在Kubernetes集群中工作时遇到了一些麻烦。根据https://kubernetes.github.io/ingress-nginx/deploy/,我已经创建了nginx-ingress部署,服务,角色等。

我还部署了一个hello-world监听端口的简单应用8080

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: hello-world
  namespace: default
spec:
  selector:
    matchLabels:
      name: hello-world
  template:
    metadata:
      labels:
        name: hello-world
    spec:
      containers:
      - name: hello-world
        image: myrepo/hello-world
        resources:
          requests:
            memory: 200Mi
            cpu: 150m
          limits:
            cpu: 300m
        ports:
          - name: http
            containerPort: 8080
            protocol: TCP
Run Code Online (Sandbox Code Playgroud)

并为其创建了服务

kind: Service
apiVersion: v1
metadata:
  namespace: default
  name: hello-world
spec:
  selector:
    app: hello-world
  ports:
    - name: server
      port: 8080
Run Code Online (Sandbox Code Playgroud)

最后,我创建了一个TLS密码(my-tls-secret),并按照说明部署了nginx入口。例如:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: …
Run Code Online (Sandbox Code Playgroud)

nginx kubernetes kubernetes-ingress nginx-ingress

4
推荐指数
2
解决办法
3970
查看次数

yq:按字母顺序将新值添加到列表中

我有一个简单的 yaml 文件,名为foo.yaml

foo:
 - a
 - c
bar:
 - foo: bar
   foo2: bar2
Run Code Online (Sandbox Code Playgroud)

我正在尝试按字母顺序向 中添加新值 ( b) foo。我可以使用 添加值+=,但它不会按字母顺序排列

$ yq '.foo += "b"' foo.yaml

foo:
  - a
  - c
  - b
bar:
  - foo: bar
    foo2: bar2
Run Code Online (Sandbox Code Playgroud)

如果我使用+我可以使用sort,但我只能得到原始值。例如:

$ yq '.foo += "b"' foo.yaml

foo:
  - a
  - c
  - b
bar:
  - foo: bar
    foo2: bar2
Run Code Online (Sandbox Code Playgroud)

我尝试将其设置为 bash 变量,然后将其与 一起使用=,但它显示为多行文本

$ yq '.foo + "b" | …
Run Code Online (Sandbox Code Playgroud)

yaml yq

2
推荐指数
1
解决办法
1048
查看次数