LoginSignup
1
1

More than 3 years have passed since last update.

Fargate+Selenium+ChromDriverでスクレイピング時に"tab crush"が頻発した

Last updated at Posted at 2020-03-12

はじめに

Fargateにchromedriverを格納したコンテナをデプロイし、スクレイピングを実行する環境を構築しました。タスクを実行すると"tab crush"が発生し、コンテナが停止してしまいました。少しつまづいたので、備忘録を兼ねて解決策を投稿します。

環境

以下の環境で実行しました。
my-first-document.png

・APP container
 使用したDockerImage:python:3.7-slim
 メモリ:1GB
 タスクCPU:0.25V

・selenium container
 使用したDockerImage:selenium/standalone-chrome
 メモリ:1GB
 タスクCPU:0.25V

状況

・Fragateでタスクを実行するとタスクは正常に起動しスクレイピングが実行される。
・数分後にタスクの状況を確認すると"tab crush"が発生し、タスクがSTOPしている。
・"tab crush"は毎回発生するが、停止位置がまばら。

デバッグ

Cloud Watchのメトリクスを確認するとSeleniumコンテナのメモリ使用率が99%に張り付いていることが発覚。Seleniumコンテナのメモリを8GBにしました。するとスクレイピングを完走してくれるようになりました。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1