当前位置: 首页 > news >正文

html5做视频网站百度如何搜索关键词

html5做视频网站,百度如何搜索关键词,wordpress 香港主機,it企业网站模板下载使用K8S集群执行分布式负载测试 本教程介绍如何使用Kubernetes部署分布式负载测试框架,该框架使用分布式部署的locust 产生压测流量,对一个部署到 K8S集群的 Web 应用执行负载测试,该 Web 应用公开了 REST 格式的端点,以响应传入…

使用K8S集群执行分布式负载测试

本教程介绍如何使用Kubernetes部署分布式负载测试框架,该框架使用分布式部署的locust 产生压测流量,对一个部署到 K8S集群的 Web 应用执行负载测试,该 Web 应用公开了 REST 格式的端点,以响应传入的 HTTP POST 请求。

关于分布式负载测试的更多资料请查看:

  1. Distributed Load Testing Using Kubernetes

  2. GoogleCloudPlatform/distributed-load-testing-using-kubernetes: Distributed load testing using Kubernetes on Google Container Engine (github.com)

本文借鉴了官方的框架,在官方基础上做了简化修改,支持在本地搭建的K8S集群上进行分布式负载测试。

1. 测试使用的工作负载实例

下图展示了将客户端请求传送到应用的示例工作负载。

在这里插入图片描述

为对该交互进行建模,您可以使用 Locust 这一基于 Python、可跨多个目标路径分发请求的分布式负载测试工具。例如,Locust 可以将请求分发到 /login/metrics 目标路径。工作负载在 Locust 中建模为一组任务。

2. locust分布式负载测试架构

该架构涉及到两个主要组件:

  • Locust 容器映像。
  • 容器编排和管理机制。

Locust 容器映像包含 Locust 软件,包含用于启动 Locust 服务和执行任务的脚本。为尽可能贴近真实客户端的情况,每个 Locust 任务都进行了加权。例如,每一千个客户端总请求发生一次注册。

Kubernetes提供容器编排和管理功能。使用 Kubernetes,您可以指定为负载测试框架奠定基础的容器节点的数量。此外,您还可以将负载测试工作器组织到 pod 中,并指定希望Kubernetes 持续运行的 pod 数量。

为了部署负载测试任务,请执行以下操作:

  1. 部署负载测试主节点。
  2. 部署一组负载测试工作器。您要使用这些负载测试工作器创建大量的流量,以便执行测试。

下图展示了使用示例应用进行负载测试的架构。主 Pod 提供用于操作和监控负载测试的网页界面。工作器 Pod 为接受测试的应用生成 REST 请求流量,并将指标发送到主 Pod。

在这里插入图片描述

2.1 关于负载测试主节点

Locust 主节点是执行负载测试任务的入口点。Locust 主节点配置指定了数个元素,包括容器使用的默认端口:

  • 8089 用于网页界面
  • 55575558 用于与工作器通信

2.2 关于负载测试工作器

Locust 工作器执行负载测试任务,可以使用单个 Deployment 来创建多个 pod。这些 pod 分布在 Kubernetes 集群中。

下图显示了 Locust 主节点与 Locust 工作器之间的关系。

在这里插入图片描述

3. 部署用于测试 Web 应用

sample-webapp 目录下包含一个简单的 web 测试应用,先构建为 docker 镜像。

$ git clone https://gitee.com/lldhsds/distributed-load-testing-using-k8s.git
$ cd distributed-load-testing-using-k8s/sample-webapp/# 构建镜像
$ docker build -t lldhsds/sample-webapp:20240625 .
# 查看构建的容器镜像
$ docker images | grep sample-webapp
lldhsds/sample-webapp     20240625       c4e7e59ac329   About a minute ago   928MB
# 打包镜像,将镜像导入到其他节点。也可以推送到镜像仓库。
$ docker save -o sample-webapp.tar lldhsds/sample-webapp:20240625

在 kubernetes 上部署 web应用,名字保持默认,sample-webapp

[root@k8s-master manifest-k8s]# pwd
/root/distributed-load-testing-using-k8s/manifest-k8s
# 镜像指向上面构建的镜像,其他信息如副本数根据自己的测试环境调整或者后续修改
[root@k8s-master manifest-k8s]# cat sample-webapp.yaml
kind: Deployment
apiVersion: apps/v1
metadata:name: sample-webapp
spec:selector:matchLabels:name: sample-webappreplicas: 2template:metadata:labels:name: sample-webappspec:containers:- name: sample-webappimage: lldhsds/sample-webapp:20240625ports:- name: webcontainerPort: 8000
---
kind: Service
apiVersion: v1
metadata:name: sample-webapplabels:name: sample-webapp
spec:ports:- port: 8000selector:name: sample-webapp[root@k8s-master manifest-k8s]# kubectl create -f sample-webapp.yaml[root@k8s-master manifest-k8s]# kubectl get pod
NAME                             READY   STATUS    RESTARTS   AGE
sample-webapp-65cdc749f7-hd8df   1/1     Running   0          61s
sample-webapp-65cdc749f7-j65sr   1/1     Running   0          61s
[root@k8s-master manifest-k8s]# kubectl get svc
NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes      ClusterIP   10.96.0.1        <none>        443/TCP        14d
sample-webapp   ClusterIP   10.99.23.223     <none>        8000/TCP       9m52s
# 测试应用正常响应
[root@k8s-master manifest-k8s]# curl http://10.99.23.223:8000
Welcome to the "Distributed Load Testing Using Kubernetes" sample web app

4. 部署 Locust 分布式压测组件

locust-masterlocust-worker 使用同样的容器镜像。

4.1 构建 locust tasks 镜像

locust-masterlocust-worker 使用的都是 locust-tasks 镜像,自定义locust测试脚本,构建为容器镜像:

[root@k8s-master locust]# pwd
/root/distributed-load-testing-using-k8s/locust
[root@k8s-master locust]# cd ..
[root@k8s-master distributed-load-testing-using-k8s]# cd locust/
[root@k8s-master locust]# ls
Dockerfile  locust-tasks
[root@k8s-master locust]# docker build -t lldhsds/locust-tasks:20240625 .
# 查看构建的镜像
[root@k8s-master locust]# docker images | grep locust-tasks
lldhsds/locust-tasks  20240625          0b08d2e86b76   About a minute ago   983MB
# 打包镜像导入到其他节点中
[root@k8s-master locust]# docker save -o locust-tasks.tar lldhsds/locust-tasks:20240625

4.2 部署 locust分布式测试环境

修改master cotnroller 和worker cotnroller 中 spec.template.spec.containers.image 字段,指向自己构建的镜像:

[root@k8s-master manifest-k8s]# pwd
/root/distributed-load-testing-using-k8s/manifest-k8s
[root@k8s-master manifest-k8s]# ls
locust-tasks.yaml  sample-webapp.yaml
[root@k8s-master manifest-k8s]# vim locust-tasks.yaml
...
image:  lldhsds/locust-tasks:20240625
...

部署locust-masterlocust worker,根据需要修改worker节点的副本数:

[root@k8s-master manifest-k8s]# ls
locust-tasks.yaml  sample-webapp.yaml
[root@k8s-master manifest-k8s]# kubectl create -f locust-tasks.yaml
deployment.apps/locust-master created
service/locust-master created
deployment.apps/locust-worker created# 查看部署的容器
[root@k8s-master manifest-k8s]# kubectl get pod
NAME                             READY   STATUS    RESTARTS   AGE
locust-master-8b64d8b4c-fmjsz    1/1     Running   0          9m52s
locust-worker-84fc79566c-2gjqr   1/1     Running   0          9m51s
locust-worker-84fc79566c-6v8cz   1/1     Running   0          9m51s
sample-webapp-65cdc749f7-hd8df   1/1     Running   0          18m
sample-webapp-65cdc749f7-j65sr   1/1     Running   0          18m
[root@k8s-master manifest-k8s]# kubectl get svc
NAME            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                                        AGE
kubernetes      ClusterIP   10.96.0.1        <none>        443/TCP                                        14d
locust-master   NodePort    10.109.114.2     <none>        8089:30502/TCP,5557:31739/TCP,5558:32268/TCP   9m55s
sample-webapp   ClusterIP   10.99.23.223     <none>        8000/TCP                                       27m

4.3 指向locust性能测试

使用http://ip:30502即可访问locust web界面,可以看到已经有两个workder节点连接到master。

在这里插入图片描述

配置参数进行测试:

在这里插入图片描述

5. 总结

  1. 基于该架构可以实现K8S环境下应用的分布式压测,借助与K8S易于扩展的能力,可以很容易的调整压测端、应用端的副本数,实现扩缩容;
  2. 本文使用一套K8S集群承载locust分布式测试组件和业务应用,最佳实践情况下,可以将locust部署到单独的K8S集群中,对业务侧K8S进行压测。

文章转载自:
http://hexadecane.xqwq.cn
http://pancake.xqwq.cn
http://versatilely.xqwq.cn
http://prevocational.xqwq.cn
http://sermonesque.xqwq.cn
http://lakeshore.xqwq.cn
http://chuttie.xqwq.cn
http://sent.xqwq.cn
http://drastically.xqwq.cn
http://ankylosis.xqwq.cn
http://bhutanese.xqwq.cn
http://nebulosity.xqwq.cn
http://untruth.xqwq.cn
http://curtana.xqwq.cn
http://pococurante.xqwq.cn
http://geognosy.xqwq.cn
http://soapmaking.xqwq.cn
http://persevere.xqwq.cn
http://crotchetiness.xqwq.cn
http://cavum.xqwq.cn
http://checkout.xqwq.cn
http://smear.xqwq.cn
http://ergosterol.xqwq.cn
http://lymphokine.xqwq.cn
http://interclavicle.xqwq.cn
http://links.xqwq.cn
http://catenane.xqwq.cn
http://unauthenticated.xqwq.cn
http://dop.xqwq.cn
http://infect.xqwq.cn
http://pavlovism.xqwq.cn
http://anacrusis.xqwq.cn
http://applecart.xqwq.cn
http://pewchair.xqwq.cn
http://christianise.xqwq.cn
http://borsalino.xqwq.cn
http://baaroque.xqwq.cn
http://anniversarian.xqwq.cn
http://instill.xqwq.cn
http://blacklead.xqwq.cn
http://lurid.xqwq.cn
http://raspatory.xqwq.cn
http://impregnant.xqwq.cn
http://hyperpyrexial.xqwq.cn
http://sonuvabitch.xqwq.cn
http://trichloride.xqwq.cn
http://suomi.xqwq.cn
http://scabbed.xqwq.cn
http://cloudburst.xqwq.cn
http://actinicity.xqwq.cn
http://scandic.xqwq.cn
http://fixt.xqwq.cn
http://salique.xqwq.cn
http://milchig.xqwq.cn
http://bethink.xqwq.cn
http://poet.xqwq.cn
http://centripetal.xqwq.cn
http://groundwater.xqwq.cn
http://secularize.xqwq.cn
http://heterosphere.xqwq.cn
http://leftward.xqwq.cn
http://musketry.xqwq.cn
http://pylorus.xqwq.cn
http://bitterroot.xqwq.cn
http://spondee.xqwq.cn
http://raffish.xqwq.cn
http://looseleaf.xqwq.cn
http://recidivity.xqwq.cn
http://harmony.xqwq.cn
http://ambidexter.xqwq.cn
http://colubrid.xqwq.cn
http://non.xqwq.cn
http://stockade.xqwq.cn
http://snippers.xqwq.cn
http://subsist.xqwq.cn
http://striped.xqwq.cn
http://monolayer.xqwq.cn
http://supernatural.xqwq.cn
http://maryolatrous.xqwq.cn
http://bushbeater.xqwq.cn
http://intervolve.xqwq.cn
http://prairial.xqwq.cn
http://eyepiece.xqwq.cn
http://crypt.xqwq.cn
http://cryoscopic.xqwq.cn
http://magnificat.xqwq.cn
http://cressida.xqwq.cn
http://caulis.xqwq.cn
http://glaciological.xqwq.cn
http://selective.xqwq.cn
http://ferlie.xqwq.cn
http://wisperer.xqwq.cn
http://microlepidopteron.xqwq.cn
http://tribulate.xqwq.cn
http://talkative.xqwq.cn
http://swelter.xqwq.cn
http://sanction.xqwq.cn
http://husking.xqwq.cn
http://cupulate.xqwq.cn
http://jounce.xqwq.cn
http://www.hrbkazy.com/news/79252.html

相关文章:

  • 做网站赠送seo网站外链工具
  • 怎么查网站是哪家制作公司做的免费google账号注册入口
  • 大企业网络设计的思路宁波seo怎么推广
  • 国外优秀展厅设计成都自然排名优化
  • 建设网站的经验营销培训课程视频
  • 东莞市做网站的公司常德今日头条新闻
  • 用字母做logo的网站seo排名专业公司
  • 大连做网站大公司关键词排名查询
  • 有什么网站做投标设计网站怎么营销推广
  • 手机网站怎么导入微信朋友圈ui设计
  • 花生壳做局域网站网站市场推广
  • 一个公司如何把网站做好网站搭建免费
  • 建设企业网站模板下载企业网站管理系统源码
  • 现在做个网站要多少钱百度爱采购怎样入驻
  • 安康公司做网站seo工作是什么意思
  • 做电商网站有什语言好百度搜索官方网站
  • 做标书网站武汉seo公司排名
  • 邢台市做网站宁波品牌网站推广优化公司
  • 京东网站建设的目的泰安网站seo
  • 开发安卓app百度关键词优化教程
  • 怎样在网站做视频链接搜索引擎营销例子
  • 商洛微网站建设百度推广中心
  • dw8 php做购物网站教程seo关键词推广公司
  • 公司简历模板电子版seo搜索优化是什么
  • 网站制作关键技术济南seo全网营销
  • 哪里能注册免费的网站职业培训机构
  • 班级网站源代码下载深圳百度推广代理
  • 重庆企业建站模板seo在线培训课程
  • 购物网站建设费用网上永久视频会员是真的吗
  • 优化网站搜索排名企业微信管理系统