跳转到主要内容

Galileo:一个用于分布式负载测试实验的框架

项目描述

Galileo:一个用于分布式负载测试实验的框架

PyPI Version Build Status Coverage Status

此项目允许用户定义、运行和交互式地使用针对分布式面向服务的系统的分布式负载测试实验。Galileo包含两个主要组件:用户可以与之交互的实验控制器外壳和Galileo仪表板。实验控制器可以在工作器上生成模拟客户端,并控制它们产生的负载量。此外,用户还可以与服务路由表外壳交互,以控制将服务请求发送到哪个集群节点。

构建

创建一个新的虚拟环境并安装所有依赖项

make venv

Docker

要创建可以运行Galileo组件的Docker镜像,请运行

make docker

要创建可以运行Galileo组件的arm32v7 Docker镜像,请运行

make docker-arm

使用以下命令启动工作器

cd docker/galileo-worker
docker-compose up

arm32v7的Compose文件位于

docker/arm

启动本地开发环境,包括:API、ExperimentDaemon、1个工作器、redis和数据库

cd docker/dev
docker-compose up

准备示例应用程序

我们使用示例应用程序准备集群。具体来说是一个图像分类服务。

将mxnet-model-server作为名为'mms'的Docker容器运行,在端口8080上公开。例如,要在集群节点上以squeezenet和alexnet模型启动mxnet-model-server,请运行以下命令

docker run -itd --name mms -p 8080:8080 -p 8081:8081 awsdeeplearningteam/mxnet-model-server:1.0.0-mxnet-cpu mxnet-model-server --start \
--models squeezenet=https://s3.amazonaws.com/model-server/models/squeezenet_v1.1/squeezenet_v1.1.model,alexnet=https://s3.amazonaws.com/model-server/model_archive_1.0/alexnet.mar

准备实验工作器主机

需要运行实验控制器主机应用程序的设备需要托管生成负载的工作器。

bin/run worker --logging=INFO

所有运行时参数都通过galileo_*环境变量进行控制。请查看docker/galileo-worker/worker.env以获取一些示例。

所有以galileo_开头的环境变量都可以在创建客户端组时用作工作标签。

例如,如果您使用环境变量galileo_zone=A启动工作进程,您可以根据以下方式生成仅包含此标签的工作进程的客户端组

g.spawn('service',worker_labels={'galileo_zone': 'A'})

运行实验控制器外壳

(.venv) pi@graviton:~/edgerun/galileo $ bin/run shell
                                   __  __
 .-.,="``"=.          ____ _____ _/ (_) /__  ____
 '=/_       \        / __ `/ __ `/ / / / _ \/ __ \
  |  '=._    |      / /_/ / /_/ / / / /  __/ /_/ /
   \     `=./`.     \__, /\__,_/_/_/_/\___/\____/
    '=.__.=' `='   /____/


Welcome to the galileo shell!

Type `usage` to list available functions

galileo> usage
the galileo shell is an interactive python shell that provides the following commands

Commands:
  usage         show this message
  env           show environment variables
  pwd           show the current working directory

Functions:
  sleep         time.sleep wrapper

Objects:
  g             Galileo object that allows you to interact with the system
  show          Prints runtime information about the system to system out
  exp           Galileo experiment
  rtbl          Service routing table

Type help(<function>) or help(<object>) to learn how to use the functions.

配置路由表

外壳中的rtbl对象允许您设置负载均衡策略。在galileo外壳中运行help(rtbl)。以下是如何为服务myservice设置记录的示例。

galileo> rtbl.set('myservice', ['host1:8080', 'host2:8080'], [1,2])
RoutingRecord(service='myservice', hosts=['host1:8080', 'host2:8080'], weights=[1, 2])
galileo> rtbl
+---------------------------+----------------------+-----------+
| Service                   |                Hosts |   Weights |
+---------------------------+----------------------+-----------+
| myservice                 |           host1:8080 |       1.0 |
|                           |           host2:8080 |       2.0 |
+---------------------------+----------------------+-----------+

运行实验守护进程


FIXME:这已经过时


实验守护进程持续从阻塞的redis队列galileo:experiments:instructions读取。接收到指令后,控制器将执行命令并记录通过Redis发布的遥测数据。最后将实验状态设置为'完成',并将客户端保存到数据库中的跟踪更新为引用实验。

注入新实验的示例Redis命令(其中exphost是实验主机的主机名)

LPUSH galileo:experiments:instructions '{"instructions": "spawn exphost squeezenet 1\nsleep 2\nrps exphost squeezenet 1\nsleep 5\nrps exphost squeezenet 0\nsleep 2\nclose exphost squeezenet"}'

您还可以指定exp_idcreatorname,否则将使用一些生成的/标准值。

您可以通过环境galileo_expdb_driversqlitemysql)更改存储实验数据的数据库。要将更改写入MySQL(或MariaDB),请设置以下环境变量:galileo_expdb_mysql_hostgalileo_expdb_mysql_portgalileo_expdb_mysql_dbgalileo_expdb_mysql_usergalileo_expdb_mysql_password

您可以使用以下命令创建一个mariadb docker实例

./bin/run-db.sh

然后执行守护进程

python -m galileo.cli.experimentd

或运行脚本,该脚本从docker容器导出mariadb设置(添加--logging DEBUG以输出)

./bin/experimentd-mysql.sh

运行Galileo REST API

使用gunicorn提供服务

gunicorn -w 4 --preload -b 0.0.0.0:5001 \
    -c galileo/webapp/gunicorn.conf.py \
    galileo.webapp.wsgi:api

项目详细信息


下载文件

下载您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

edgerun-galileo-0.10.4.tar.gz (45.9 kB 查看哈希值

上传时间

构建分发

edgerun_galileo-0.10.4-py3.8.egg (166.9 kB 查看哈希值)

上传时间 来源

由以下支持