Skip to content

Commit

Permalink
Adding support for SE_NODE_OVERRIDE_MAX_SESSIONS (#1255) [deploy][pre…
Browse files Browse the repository at this point in the history
…release]
  • Loading branch information
diemol committed Apr 2, 2021
1 parent 0ba9433 commit 0496646
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Base/Dockerfile
Expand Up @@ -71,7 +71,7 @@ COPY supervisord.conf /etc
RUN mkdir -p /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor \
&& touch /opt/selenium/config.toml \
&& chmod -R 777 /opt/selenium /opt/selenium/assets /var/run/supervisor /var/log/supervisor /etc/passwd \
&& wget --no-verbose https://github.com/SeleniumHQ/docker-selenium/raw/beta-jars/selenium-server-4.0.0-prerelease-beta-3-d798b52c4c.jar \
&& wget --no-verbose https://github.com/SeleniumHQ/docker-selenium/raw/beta-jars/selenium-server-4.0.0-prerelease-beta-3-fcfbc6ba25.jar \
-O /opt/selenium/selenium-server.jar \
# && wget --no-verbose https://selenium-release.storage.googleapis.com/4.0-beta-1/selenium-server-4.0.0-beta-1.jar \
# -O /opt/selenium/selenium-server.jar \
Expand Down
2 changes: 2 additions & 0 deletions NodeBase/Dockerfile.txt
Expand Up @@ -163,6 +163,8 @@ ENV START_XVFB true
ENV SE_NODE_MAX_SESSIONS 1
# As integer, maps to "session-timeout" in seconds
ENV SE_NODE_SESSION_TIMEOUT 300
# As boolean, maps to "override-max-sessions"
ENV SE_NODE_OVERRIDE_MAX_SESSIONS false

# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
Expand Down
1 change: 1 addition & 0 deletions NodeBase/generate_config
Expand Up @@ -31,6 +31,7 @@ else
echo "grid-url = \"${SE_NODE_GRID_URL}\"" >> /opt/selenium/config.toml
fi
echo "session-timeout = \"${SE_NODE_SESSION_TIMEOUT}\"" >> /opt/selenium/config.toml
echo "override-max-sessions = ${SE_NODE_OVERRIDE_MAX_SESSIONS}" >> /opt/selenium/config.toml
echo "max-sessions = ${SE_NODE_MAX_SESSIONS}
" >> /opt/selenium/config.toml

Expand Down
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -417,6 +417,20 @@ can do that through the `SE_NODE_GRID_URL` environment variable.
Grid has a default session timeout of 300 seconds, where the session can be on a stale state until it is killed. You can use
`SE_NODE_SESSION_TIMEOUT` to overwrite that value in seconds.

### Increasing session concurrency per container

By default, only one session is configured to run per container through the `SE_NODE_MAX_SESSIONS` environment variable. It is
possible to increase that number up to the maximum available processors, this is because more stability is achieved when one
container/browser has 1 CPU to run.

However, if you have measured performance and based on that, you think more sessions can be executed in each container, you can
override the maximum limit by setting both `SE_NODE_MAX_SESSIONS` to a desired number and `SE_NODE_OVERRIDE_MAX_SESSIONS` to
`true`. Nevertheless, running more browser sessions than the available processors is not recommended since you will be overloading
the resources.

Overriding this setting has a undesired side effect when video recording is enabled, since more than one browser session might be
captured in the same video.

### Running in Headless mode

[Firefox](https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Headless_mode),
Expand Down
2 changes: 2 additions & 0 deletions Standalone/start-selenium-standalone.sh
Expand Up @@ -9,4 +9,6 @@ fi
java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar standalone \
--relax-checks ${SE_RELAX_CHECKS} \
--session-timeout ${SE_NODE_SESSION_TIMEOUT} \
--max-sessions ${SE_NODE_MAX_SESSIONS} \
--override-max-sessions ${SE_NODE_OVERRIDE_MAX_SESSIONS} \
${SE_OPTS}

0 comments on commit 0496646

Please sign in to comment.