【发布时间】:2017-09-22 15:56:37
【问题描述】:
问题: Selenuim Webdriver 驱动的 UI 测试通过 Mocha 在 NodeJS 平台上执行并在 AWS ECS 上运行,速度很慢,以至于经常超时(超时 = 120000 毫秒,即 2 分钟)。
设置:
- 我在 AWS ECS 上有一个集群。集群有 3 个 m4.xlarge 实例,因此 CPU/内存不是问题。此外,EC2 实例指标显示,即使在运行测试时,CPU/内存利用率也低于 1%。
-
每个容器都使用以下 JSON 定义:
{ "requiresAttributes": [ { "value": null, "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18", "targetId": null, "targetType": null }, { "value": null, "name": "com.amazonaws.ecs.capability.ecr-auth", "targetId": null, "targetType": null } ], "taskDefinitionArn": "someDefinition", "networkMode": "host", "status": "ACTIVE", "revision": 23, "taskRoleArn": null, "containerDefinitions": [ { "volumesFrom": [], "memory": 400, "extraHosts": null, "linuxParameters": null, "dnsServers": null, "disableNetworking": null, "dnsSearchDomains": null, "portMappings": [ { "hostPort": 80, "containerPort": 80, "protocol": "tcp" } ], "hostname": null, "essential": true, "entryPoint": [], "mountPoints": [ { "containerPath": "/dev/shm", "sourceVolume": "hostDevShm", "readOnly": null } ], "name": "foo-automation-container", "ulimits": null, "dockerSecurityOptions": null, "environment": [], "links": null, "workingDirectory": null, "readonlyRootFilesystem": null, "image": "foo-docker-container-image", "command": [], "user": null, "dockerLabels": null, "logConfiguration": null, "cpu": 0, "privileged": null, "memoryReservation": null } ], "placementConstraints": [], "volumes": [ { "host": { "sourcePath": "/dev/shm" }, "name": "hostDevShm" } ], "family": "foo-automation-tests" }
我尝试了什么?
除了销毁和重新创建集群和任务 定义了无数次,我设置了Network Mode = host,我 已添加基于this 链接的卷挂载。
我已确保这些测试完美运行(并且在他们的 通常速度)在本地虚拟机上托管的容器上 - 问题 仅适用于 AWS ECS 配置。
我已经在网上搜索了几天来解决这个问题,包括 SO、Docker 的帮助论坛和 AWS 文档。
此时,我已经碰壁了。非常感激任何的帮助。
如果需要任何其他信息,请告诉我。
【问题讨论】:
-
所以问题更多在于浏览器在 AWS 中运行缓慢?
-
实际上是的,尽管我会更准确地说,执行测试的每个步骤所花费的时间比在 VM 上要长得多,即每个请求/响应所需的时间似乎是 5 -10 倍的容器时间。
-
你是如何运行网格的?这个任务看起来像你的任务/执行代码,而不是我假设的网格
-
正确。我不是按设计在 Selenium 网格上运行的,所以没有网格配置。
-
那么在同一个容器中浏览器也正在启动?
标签: docker selenium-webdriver mocha.js amazon-ecs